hudson.tasks
Class Publisher

java.lang.Object
  extended by hudson.tasks.BuildStepCompatibilityLayer
      extended by hudson.tasks.Publisher
All Implemented Interfaces:
Describable<Publisher>, BuildStep
Direct Known Subclasses:
Notifier, Recorder

public abstract class Publisher
extends BuildStepCompatibilityLayer
implements BuildStep, Describable<Publisher>

BuildSteps that run after the build is completed.

To register a custom Publisher from a plugin, put Extension on your descriptor implementation.

Starting 1.178, publishers are exposed to all kinds of different project type, not just the freestyle project type (in particular, the native maven2 job type.) This is convenient default for Publishers in particular initially, but we encourage advanced plugins to consider writing MavenReporter, as it offers the potential of reducing the amount of configuration needed to run the plugin. For those plugins that don't want Publisher to show up in different job type, use BuildStepDescriptor for the base type of your descriptor to control which job type it supports.

Author:
Kohsuke Kawaguchi, Anton Kozak

Nested Class Summary
static class Publisher.DescriptorExtensionListImpl
          Publisher has a special sort semantics that requires a subtype.
 
Nested classes/interfaces inherited from interface hudson.tasks.BuildStep
BuildStep.PublisherList
 
Field Summary
 
Fields inherited from interface hudson.tasks.BuildStep
BUILDERS, PUBLISHERS
 
Method Summary
static DescriptorExtensionList<Publisher,Descriptor<Publisher>> all()
          Returns all the registered Publisher descriptors.
 Descriptor<Publisher> getDescriptor()
          Gets the descriptor for this instance.
 Action getProjectAction(Project project)
          Deprecated. since 1.150
 boolean needsToRun(Result buildResult)
          Returns true if this Publisher needs to run depends on Build Result.
 boolean needsToRunAfterFinalized()
          Return true if this Publisher needs to run after the build result is fully finalized.
 boolean prebuild(Build build, BuildListener listener)
          Deprecated. since 1.150
 
Methods inherited from class hudson.tasks.BuildStepCompatibilityLayer
getProjectAction, getProjectActions, perform, perform, prebuild
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface hudson.tasks.BuildStep
getProjectAction, getProjectActions, getRequiredMonitorService, perform, prebuild
 

Method Detail

prebuild

@Deprecated
public boolean prebuild(Build build,
                                   BuildListener listener)
Deprecated. since 1.150

Default implementation that does nothing.

Overrides:
prebuild in class BuildStepCompatibilityLayer

getProjectAction

@Deprecated
public Action getProjectAction(Project project)
Deprecated. since 1.150

Default implementation that does nothing.

Overrides:
getProjectAction in class BuildStepCompatibilityLayer

needsToRunAfterFinalized

public boolean needsToRunAfterFinalized()
Return true if this Publisher needs to run after the build result is fully finalized.

The execution of normal Publishers are considered within a part of the build. This allows publishers to mark the build as a failure, or to include their execution time in the total build time.

So normally, that is the preferrable behavior, but in a few cases this is problematic. One of such cases is when a publisher needs to trigger other builds, which in turn need to see this build as a completed build. Those plugins that need to do this can return true from this method, so that the BuildStepCompatibilityLayer.perform(AbstractBuild, Launcher, BuildListener) method is called after the build is marked as completed.

When Publisher behaves this way, note that they can no longer change the build status anymore.

Since:
1.153

needsToRun

public boolean needsToRun(Result buildResult)
Returns true if this Publisher needs to run depends on Build Result.

Can be used if execution of Publisher is not required for some Build Result, i.e. ABORTED, FAILED, etc.

Since:
2.1.1

getDescriptor

public Descriptor<Publisher> getDescriptor()
Description copied from interface: Describable
Gets the descriptor for this instance.

Descriptor is a singleton for every concrete Describable implementation, so if a.getClass()==b.getClass() then a.getDescriptor()==b.getDescriptor() must hold.

Specified by:
getDescriptor in interface Describable<Publisher>

all

public static DescriptorExtensionList<Publisher,Descriptor<Publisher>> all()
Returns all the registered Publisher descriptors.



Copyright © 2004-2013 Hudson. All Rights Reserved.