How to run Maven with JDK 7


We would like to use an Agent Template maven-jdk-7 i.e. using a Agent with Maven using Java 7.


  • CloudBees Jenkins Enterprise (CJE)
  • Docker Template Agents Maven JDK7


Java 7 is not longer supported by CloudBees (CloudBees Supported Java) for any type of node. Thus, it is extensible to CJE agents too.

Workaround: Create your own Docker Image ( Dockerfile) making available Java 7 for Maven and 8 for slave.jar (remoting).

  1. In your PATH you declare the path to the Java 8 bin folder.
  2. In you docker image (or in the agent template config) you configure JAVA_HOME to point to the JDK 7 and then Maven will use it.

Note: The normal procedure for providing tools to Agents (e.g JDK7) is via GUI Manage Jenkins > Global Tool Configuration but tools would be downloaded each time the agent is connected because it is Docker Agent (ephemeral), thus it is not recommended.

Have more questions? Submit a request


Please sign in to leave a comment.