Package hudson.init
Annotation Interface Initializer
Placed on methods to indicate that this method is to be run during the Jenkins start up to perform
some sort of initialization tasks, for example:
@Initializer(after=JOB_LOADED) public static void init() throws IOException { .... }
The method in question can be either static
or an instance method. When used with instance
methods, those methods have to be on a class annotated with Extension
and marked as
after()
InitMilestone.PLUGINS_PREPARED
.
- Author:
- Kohsuke Kawaguchi
-
Optional Element Summary
Modifier and TypeOptional ElementDescriptionIndicates that the specified milestone is necessary before executing this initializer.String[]
Indicates the milestones that this initializer contributes to.Indicates that this initializer is a necessary step before achieving the specified milestone.Key inMessages.properties
that represents what this task is about.boolean
Should the failure in this task prevent Hudson from starting up?String[]
Indicates the milestones necessary before executing this initializer.
-
Element Details
-
after
InitMilestone afterIndicates that the specified milestone is necessary before executing this initializer.This has the identical purpose as
requires()
, but it's separated to allow better type-safety when usingInitMilestone
as a requirement (since enum member definitions need to be constant).- Default:
- STARTED
-
before
InitMilestone beforeIndicates that this initializer is a necessary step before achieving the specified milestone.This has the identical purpose as
attains()
. Seeafter()
for why there are two things to achieve the same goal.- Default:
- COMPLETED
-
requires
String[] requiresIndicates the milestones necessary before executing this initializer.- Default:
- {}
-
attains
String[] attainsIndicates the milestones that this initializer contributes to. A milestone is considered attained if all the initializers that attains the given milestone completes. So it works as a kind of join.- Default:
- {}
-
displayName
String displayNameKey inMessages.properties
that represents what this task is about. Used for rendering the progress. Defaults to "${short class name}.${method Name}".- Default:
- ""
-
fatal
boolean fatalShould the failure in this task prevent Hudson from starting up?- See Also:
-
Task.failureIsFatal()
- Default:
- true
-