Creating a New Plugin
To start developing a new Jenkins plugin, use an IDE (below), or if you are more comfortable with Maven, run the following command:
$ mvn archetype:generate -Dfilter=io.jenkins.archetypes:plugin
This will ask you a few questions, 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.
Make sure you can build this:
$ cd newly-created-directory $ mvn package
-U means that Maven should update all relevant Maven plugins (check for plugin updates)
hpi: this prefix specifies that the Jenkins HPI Plugin is being invoked, a plugin that supports development of Jenkins plugins
create is the goal which creates the directory layout and the POM for your new Jenkins plugin and it adds it to the module list
package is a standard phase which compiles all sources, runs the tests and creates a package - when used by the HPI plugin it will create 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.
You are advised to use the NetBeans plugin for Jenkins/Stapler development. This offers many Jenkins-specific features. Most visibly, create a new plugin using New Project » Maven » Jenkins Plugin, and use Run Projectroject to test it.
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. Consider installing IntelliJ IDEA plugin for Stapler to make the development easier.