Before we proceed with developing the plugin, there is an important concept to understand: How the different project types invoke their plugins.
Currently, one of the biggest source of confusion for end users of Hudson is that most of the plugins do not work with the “m2 project type”. This is because there are essentially two completely different implementations of plugins.
“Normal” plugins work with all project types except the “m2 project type”. Typically they will extend Publisher. The model of execution is that the Publisher is invoked on the Hudson Master and can invoke actions remotely on the slave.
This is the first part of a tutorial on writing a Hudson plug-in. The aim of this tutorial is to develop a Publisher for JavaNCSS. This publisher will work with both Hudson Freestyle projects and Hudson Maven2 projects. The publisher will also include a trend graph.
Before we can start plug-in development, we need to have a set of working projects to throw at our plugin. Ideally these projects should be simple and quick to build, but the most essential thing is that they build and run the tool that we want to publish the results of! We need a minimum of three projects:
Note to self, for later reading
http://technology.amis.nl/blog/?p=2610
Not sure why netbeans is essential on this!
This morning I discovered sventon (http://www.sventon.org) a Subversion (http://subversion.tigris.org/) repository browser written in Java. And it’s free! Ten minutes later I had this integrated as a Repository browser in Hudson (https://hudson.dev.java.net/ will be available in build 1.157) and I’m loving it. It’s not quite as good as fisheye… but it does everything I need it to!
Hudson is really starting to have kick-ass features that leave everything else for dust.
Note to self, here are some code coverage tools for .NET that are free to use… and therefore good candidates for having the Coverage plugin for Hudson support off the shelf:
A UML renderer written in Java http://snipsnap.org/space/SnipGraph/UML+ExampleA
Sequence Diagram renderer written in Java http://sdedit.sourceforge.net/
A more complex set of UML digrams from UMLet http://www.umlet.com/
A JavaScript code formatter http://code.google.com/p/google-code-prettify/
I am sick of the fun that is getting JAX-WS 2.1 to work on JVM 1.6.
Oh, copy these four jars into the endorsed directory and then you can use JAX-WS 2.1… oh but sometimes it won’t work for some unknown reason and then it will work again.
How you are supposed to explain this to end users, I don’t know.
So next you need a platform specific installer to put those jars into the correct location, or a platform specific start script to tell the JVM about my alternate endorsed lib folder… or do I write a self-extracting jar file that exctracts the libs and forks a second JVM… no that won’t work for people wanting to use my library..
Not perfect, but enough to get you going.
To build with this pom:
You will need to grab the sources from http://downloads.sourceforge.net/jsf-comp/chartcreator-1.2.0.source.zip and extract into src/main/java
You will need to grab the jar and extract the three files in the META-INF (not MANIFEST.MF) into src/main/resources/META-INF
Then you can install away to your hearts content.
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>net.sf.jsf-comp</groupId>
<artifactId>chartcreator</artifactId>
<version>1.2.0-mavenized</version>
<packaging>jar</packaging>
<name>ChartCreator</name>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.4</source>
<target>1.4</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>1.2-b19</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>1.2-b19</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sun.facelets</groupId>
<artifactId>jsf-facelets</artifactId>
<version>1.1.11</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.portlet</groupId>
<artifactId>portlet-api</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jfree</groupId>
<artifactId>jfreechart</artifactId>
<version>1.0.5</version>
</dependency>
</dependencies>
</project>
Spent ages trying to get close to this… gave up looking at what others had done, here is my version from scratch:
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>....</groupId>
<artifactId>....</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>....</name>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1H.5-beta</version>
<configuration>
<contextPath>/</contextPath>
<scanIntervalSeconds>10</scanIntervalSeconds>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>1.2-b19</version>
</dependency>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>1.2-b19</version>
</dependency>
<dependency>
<groupId>com.sun.facelets</groupId>
<artifactId>jsf-facelets</artifactId>
<version>1.1.11</version>
</dependency>
<dependency>
<groupId>commons-digester</groupId>
<artifactId>commons-digester</artifactId>
<version>1.7</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.7.0</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>