Hudson is a continuous build system that I've been using for the past several months. It's been very useful, but my needs require a customized plugin. Although I have some ideas on how to create a great plugin, let's start with the following goal in mind:
- Add a Post-Build Action, which is persisted. Example: default JUnit plugin
- Have a trend graph for the build and project results. See an example below.
So, to set up your system, do the following:
- Install Java SDK 1.5 or later
Add it to your path and set up JAVA_HOME environment variable
- Install the latest version of Maven 2
Add it to your path and set up MAVEN_HOME environment variable
- Install your IDE (in this example, we will use Eclipse)
- Find Maven's configuration file depending on your environment:
- Add the following to your file:
mvn hpi:createNote that groupId is the equivalent of package name and artifactId is the equivalent of project name. We used "com.sacaluta" for groupId and "performance" for package name.
Let's update the Hudson version this plugin will be for. As of this writing, the version that is set up in the pom.xml file (inside the plugin directory) is 1.279. Let's change it to 1.293.
<properties>And now we use Maven to make a Eclipse project out of it to open in our IDE:
<!-- which version of Hudson is this plugin built against? -->
cdFinally, let's learn how to run Hudson from the command-line with your plugin code.
(e.g. cd performance)
mvn -DdownloadSources=true eclipse:eclipse
mvn hpi:runOnce we are done with the plugin development, we can package and distribute your .hpi plugin. This is the command to do this:
mvn packageDO NOT run "mvn package" while developing the plugin. If you do it and then want to run "mvn hpi:run", make sure to run "mvn clean" before that.
In the next post, we will start creating the plugin classes.
This first part of the plugin creation was heavily inspired in the Hudson Plugin Tutorial.