This will let you use short names of for Jenkins Maven plugins (iei.e. hpi:create instead of org.jenkins-ci.tools:maven-hpi-plugin:1.61:create).
To start a new plugin, run the following maven Maven command:
$ mvn -cpu hpi:create
This will ask you a few question, like the groupId (the maven Maven jargon for the package name) and the artifactId (the maven Maven jargon for your project name), then create a skeleton plugin from which you can start with. Make sure you can build this:
-cpu means that Maven should update all relevant Maven plugins.
hpi: as this prefix specifies that the following goal will invoke the part of the Jenkins HPI Plugin is being invoked, a plugin for supporting plugin developmentthat supports development of Jenkins plugins
create is the goal which creates the directory layout and the pom POM for the your new Jenkins plugin and it adds it to the module list
package is a standard goal phase which compiles all sources, runs the tests and creates a package - overwritten when used by the HPI plugin it will create a an
Building a Plugin
To build a plugin, run
mvn install. This will create the file
./target/pluginname.hpi that you can deploy to Jenkins.
IntelliJ 7.0 (or later) users can load pom.xml directly from IDE, and you should see all the source code of libraries and Jenkins core all the way to the bottom.
IntelliJ Maven defaults to downloading sources and JavaDocs on demand. So, to see the source, you may need to click the
If you get the error message Unable to find a plugin class. Did you put @plugin in javadoc? this maybe caused by eclipse Eclipse and maven Maven both use the target folder for build output.
Run mvn clean before building with maven Maven or change the output path.
- When you make changes to view files in
src/main/resourcesor resource files in
src/main/webapp, just hit F5 in your browser to see the changes.
- When you change Java source files. Compile , compile them in your IDE (NetBeans 6.7+: Debug > Apply Code Changes) and Jetty should automatically redeploy Jenkins to pick up those changes. There is no need to run
MAVEN_OPTS can be used to specify all sorts of other JVM parameters, like
To create a distribution image of your plugin, run the following Maven goalphase:
$ mvn package
This should create
target/*.hpi file. Other users can use Jenkins' web UI to upload this plugin to Jenkins (or place it in
- Consider running Maven like
mvn -o ...to avoid hitting repositories every time. This will make various operations considerably faster.
- Subscribe to the users' alias from here so that we can get in touch with you.
- When you bump up the version of Jenkins you depend on, make sure to run
mvn cleanonce, in particular to delete
target/workthat Jetty uses. Newer versions may just use work, not target/work. Otherwise your Jetty may continue to pick up old left-over jar JAR files.