framework’s view files for the plug-in
■ ■ src/main/webapp: The folder that con-
tains static resources for the plug-in,
The next step is to build a project for
the plug-in by running the following
the results of the implementation pro-
vided by the plug-in developer for an
extension point by running the follow-
JAVA IN ACTION
The project that is created is minimal,
but it is a complete Maven project. It can
be run without any modification using
The package command tells Maven to
build the project and create an HPI package that can be installed directly to a
The skeleton plug-in project has a
sample extension, which is fully func-
tional. You can run the project and see
Because the plug-in project is a
Maven project, the configuration of the
project is defined in the pom.xml file.
The Maven goal hpi:run is responsible
for performing several tasks, including
starting the Jetty server, adding Hudson
as a Web application to that server, and
installing the plug-in to Hudson.
Winston Prakash and Susan Duncan discuss Hudson
while onsite at JavaOne 2011.
plug-in without packaging the plug-in
as a .hpi package, which makes it easy to
do debugging during development.
Once the plug-in project has been
run successfully and the Jetty server has
been started, you can view the Hudson
main page by pointing a browser at the
Examining the sample extension. As
mentioned previously, the hpi:run command installs the plug-in to Hudson and
adds the plug-in to the Jetty server as a
Web application. This plug-in does the
■ ■ Adds an extension to the Hudson
Builder interface. This sample custom
builder is called HelloBuilder, and it
does not do anything fancy. It simply
prints the text Hello <name> to the
build console log.
■ ■ Provides a UI for configuring the
It's easy to see HelloBuilder in action by
creating a simple Hudson project—for
example, TestProject—and then configuring HelloBuilder.
You can add HelloBuilder as a builder to
TestProject by using a drop-down menu
in the Build section of the configuration page. After you add HelloBuilder as a
builder for the project, the Build section
shows HelloBuilder as one of the builders.
The task of HelloBuilder is to print the
message Hello <name> to the console
log, so enter a name in the provided
Name text box.
Because HelloBuilder is set as the only
builder of the TestProject project, when
you start a build, HelloBuilder is asked
to perform its task. Once the build is
completed, you can view the result of
HelloBuilder in the build console output.
Extending the Builder Extension Point
Now let’s look at some of the code that
extends the builder extension point so
you understand how to do the following: