//java architect /
Understanding the Hudson Plug-in
Development Framework: Part I
WINS TON PRAKASH AND
SUSAN DUNCAN
Use the Hudson Plug-in Interface tool to create, build, run, and debug custom plug-ins that extend Hudson
to meet the specific needs of your projects.
JAVA IN ACTION
This article is for beginners who are interested in understanding the fundamentals of Hudson
plug-in development. Hudson is
a popular open source continuous
integration (CI) tool written purely
in Java. Apart from being an open
source product, the popularity of
Hudson is due to its extensible
nature, which uses plug-ins and
the plug-in developer ecosystem.
Plug-ins allow developers to do
everything from customize the
way builds are done and results
are displayed to enable integration with application lifecycle
management (ALM) systems such
as software configuration management (SCM), testing
and analysis tools, and
so on. More than 400
Hudson plug-ins, supporting various aspects
of CI, are available for
free installation.
Hudson provides a
series of extension points
that allow developers
to extend Hudson’s functional-
ity. The Hudson Plug-in Interface
(HPI) tool helps developers create,
build, run, and debug plug-ins.
Tip: The HPI tool is a Maven
plug-in. Hudson extensively uses
Maven, another popular open
source software project management and comprehension tool,
which can be downloaded from
maven.apache.org.
Generating the skeleton plug-in.
The first step is to create the
skeleton plug-in, which is a
bare-bones plug-in. The following simple command tells Maven
to create the Hudson plug-in
skeleton’s source code using the
HPI tool:
Tip: Maven might throw the following error:
[ERROR] No plug-in found for
prefix 'hpi' in the current
project ..
If it does, add the following entry in the ~/.m2/settings.xml file:
<plug-inGroups>
<plug-inGroup>
org.jvnet.hudson.
tools</plug-inGroup>
</plug-inGroups>
ABOUT US
mvn hpi:create
Hudson’s
popularity
is due to its
extensible
nature.
Maven downloads all the
required software to execute the
command and prompts you for
the groupID and artifactID.
blog
PHOTOGRAPH BY BOB ADLER
Creating and Tuning a
Hudson Plug-in
First, we’ll look at how to
create a Hudson plug-in
using the HPI tool, create
and run a project for the
plug-in, and view the
plug-in in action on the
Hudson test server.
Enter the groupId of your plug-in:
org.sample.hudson
Enter the artifactId of your
plug-in:
sample-plug-in
The name of the generated
folder depends on the value you
entered for the artifactId. The file
structure of the generated folder
will have the following layout:
■ ■ pom.xml: The Maven Project
Object Model (POM) file, which
is used to build the plug-in
■ ■ src/main/java: The folder that
contains the Java source files
for the plug-in
■ ■ src/main/resources: The folder
that contains the Jelly UI