Jenkins and Java

This site is the new docs site currently being tested. For the actual docs in use please go to https://www.jenkins.io/doc.

Jenkins supports building Java projects since its inception, and for a reason! It’s both the language Jenkins is written in, plus the language in use by many if not all the projects Kohsuke Kawaguchi wanted to watch out when he created the tool many years ago.

If you want to build a Java project, there are a bunch of different options. The most typical ones nowadays are generally Apache Maven, or Gradle.

Apache Maven

In any FreeStyle job, as currently Maven is supported in standard, you can use the dedicated step. One advantage is, as for all Jenkins tools, that you can select a specific Maven version and have Jenkins automatically install it on the build node it’s going to run on.

Jenkins Maven step

Gradle

As the associated plugin is not installed by default, first install the plugin:gradle[Gradle plugin]. Once done, you should be able to add a Gradle step.

Jenkins Gradle step