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:
Unix: $HOME/.m2/settings.xml
Windows: $HOME/.m2/settings.xml - Add the following to your file:
<settings>
<profiles>
<profile>
<id>hudson</id>
<activation>
<activeByDefault />
</activation>
<pluginRepositories>
<pluginRepository>
<id>java.net2</id>
<url>http://download.java.net/maven/2</url>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>hudson</activeProfile>
</activeProfiles>
<pluginGroups>
<pluginGroup>org.jvnet.hudson.tools</pluginGroup>
</pluginGroups>
</settings>
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? -->
<hudson.version>1.293</hudson.version>
</properties>
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.
0 comments:
Post a Comment