Getting started with Jenkins plugin development is surprisingly easy. There is neat integration with Maven for building and testing a debug instance, and the build artifact can quickly be installed to an existing Jenkins instance.

Dev dependencies

Setting up the developer environment on a new system can be done through the following apt-get. However, on an older Debian (e.g. 8) or Ubuntu (~16 or older), you'd want to download Java JDK; Eclipse and Maven from their respective homes.

apt-get install openjdk-8-jdk eclipse-jdt maven

Starting from an existing plugin

Starting from an existing plugin is probably most straight forward, since a lot of the details are usually already in place. The "Test Results Analyzer Plugin" serves as a nice stand-alone example.

git clone https://github.com/jenkinsci/test-results-analyzer-plugin.git
cd test-results-analyzer-plugin

To create an Eclipse workspace which later can be opened as an existing project in Eclipse:

mvn -DdownloadSources=true -DoutputDirectory=target/eclipse-classes -Declipse.workspace=~/test-results-analyzer-plugin eclipse:eclipse eclipse:configure-workspace

To build the .hpi file which can be installed through Jenkins:

mvn hpi:hpi

For development and debugging, to create and launch a new Jenkins instance, which will have the new plugin installed.

mvn hpi:run

New plugin

Or, if you'd rather start from a clean plate, the following will create the skeleton structure.

mkdir foobar; cd foobar
mvn -U org.jenkins-ci.tools:maven-hpi-plugin:create

Once created, the commands above also apply, but you probably want to dive into the pom.xml file first, and define project information, dependencies.

Resources

For further details, see: