Jenkins is based on Java, and to build Jenkins plugins, you need to install a Java Development Kit, or JDK. Recent Jenkins releases require JDK 8 to run, so that’s what we’re using here.
Download JDK 8 for free from the Oracle website and install it.
Many Linux distributions provide packages for Oracle JDK or OpenJDK JDK for an easier install and upgrade experience.
Consult your distribution’s documentation for details.
It may even be installed already.
To find out, type
Jenkins plugins overwhelmingly use Maven to build, so that’s what we’re going to use in this tutorial.
Download Maven from its website.
Make sure to download one of the files with
bin in their name.
src indicates a source distribution.
|Many Linux distributions provide packages for Maven for an easier install and upgrade experience. Consult your distribution’s documentation for details. On macOS, the Homebrew package manager offers Maven packages. Make sure a recent version of Maven 3, ideally 3.3.9 or newer, is provided if you decide to go this route.|
Download and extract Maven, and note its location. You now have the following options:
bin/ subdirectory of the extracted directory to your
This will let you invoke Maven using
How this works is dependent on your OS and command shell.
Always use the full path to the
mvn executable, for example
The rest of the tutorial assumes that Maven is on your
PATH, but you can also just type the full path.
Once downloaded and extracted somewhere, let’s make sure everything works as expected by typing the following in a command prompt:
This prints some diagnostic output, including the versions of Java and Maven, and which Java installation was found by Maven. This should indicate a 1.8 version of Java, and list the path to the JDK. If either of these is not the case, see Troubleshooting.
Next step: Create and build your first Jenkins plugin.