Hudson Plugin

11 Oct

Plugin Workspace Layout

pom.xml

Maven uses it for building your plugin

src/main/java

Java source files of the plugin

src/main/webapp

Static resources of the plugin, such as images and HTML files.

——————— ———————- ———————

pom.xml contains

groupId This is the group ID for the plugin, and should match the common prefix to the packages used by the mojos
artifactId This is the name of the plugin
version This is the version of the plugin
packaging This should be set to “maven-plugin
dependencies A dependency must be declared to the Maven Plugin Tools API to resolve “AbstractMojo” and related classes

e.g: <project>   <modelVersion>4.0.0</modelVersion>   <groupId>sample.plugin</groupId>   <artifactId>maven-hello-plugin</artifactId>   <packaging>maven-plugin</packaging>   <version>1.0-SNAPSHOT</version>   <name>Sample Parameter-less Maven Plugin</name>   <dependencies>     <dependency>       <groupId>org.apache.maven</groupId>       <artifactId>maven-plugin-api</artifactId>       <version>2.0</version>     </dependency>   </dependencies> </project>

Steps to Creating a New Plugin:

start a new plugin, run the following maven command:

$ mvn -cpu hpi:create

This will ask you a few question, like the groupId (the maven jargon for the package name) and the artifactId (the maven jargon for your project name), then create a skeleton plugin from which you can start with.

$ cd newly-created-directory

$ mvn package

(-cpu means that Maven should update all relevant Maven plugins. hpi: as prefix specifies that the following goal will invoke the part of the Hudson HPI Plugin)

$ mvn install

This will create ./target/plugin.hpi that you can deploy to Hudson.

To install new plugin in hudson

  1. Download the new plugin file
  2. Move the old plugin file to a backup location incase you need to role back
  3. Copy in the new plugin file into the plugins directory(~hudson/hudson/plugins/)
  4. Shutdown and startup Hudson

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: