public class HelloWorldBuilder
extends hudson.tasks.Builder
Builder.
When the user configures the project and enables this builder,
Descriptor.newInstance(StaplerRequest) is invoked
and a new HelloWorldBuilder is created. The created
instance is persisted to the project configuration XML by using
XStream, so this allows you to use instance fields (like name)
to remember the configuration.
When a build is performed, the BuildStepCompatibilityLayer.perform(Build, Launcher, BuildListener) method
will be invoked.
| Modifier and Type | Class and Description |
|---|---|
static class |
HelloWorldBuilder.DescriptorImpl
Descriptor for
HelloWorldBuilder. |
| Constructor and Description |
|---|
HelloWorldBuilder(String name)
This annotation tells Hudson to call this constructor, with
values from the configuration form page with matching parameter names.
|
| Modifier and Type | Method and Description |
|---|---|
HelloWorldBuilder.DescriptorImpl |
getDescriptor()
Hudson defines a method
Builder.getDescriptor(), which
returns the corresponding Descriptor object. |
String |
getName()
We'll use this from the config.jelly.
|
boolean |
perform(hudson.model.AbstractBuild build,
hudson.Launcher launcher,
hudson.model.BuildListener listener) |
@DataBoundConstructor public HelloWorldBuilder(String name)
public String getName()
public boolean perform(hudson.model.AbstractBuild build,
hudson.Launcher launcher,
hudson.model.BuildListener listener)
perform in interface hudson.tasks.BuildStepperform in class hudson.tasks.BuildStepCompatibilityLayerpublic HelloWorldBuilder.DescriptorImpl getDescriptor()
Builder.getDescriptor(), which
returns the corresponding Descriptor object.
Since we know that it's actually HelloWorldBuilder.DescriptorImpl, override
the method and give a better return type, so that we can access
HelloWorldBuilder.DescriptorImpl methods more easily.
This is not necessary, but just a coding style preference.getDescriptor in interface hudson.model.Describable<hudson.tasks.Builder>getDescriptor in class hudson.tasks.BuilderCopyright © 2016. All rights reserved.