The project has a method getBuildersList()
which returns the list of all the build steps. You can add a build step to the project by simply adding a build step to the list returned by this method. The object you are adding to the list must be a Builder
.
I did it like this (using the plugin from the Jenkins HelloWorld tutorial as an example):
proj.getBuildersList().add(new HelloWorldBuilder("Bobbly"));
This adds a Hello World build step to the project.
Similarly, there is a getPublishersList()
method which returns the list of all the post-build steps and contains Publisher
objects.