-
Bug
-
Resolution: Fixed
-
Trivial
-
jenkins: 1.612
maven2: 2.2.1
maven plugin: 2.9
Ubuntu 14.04.2 LTS
openjdk-6-6b35-1.13.7
openjdk-7-7u79-2.5.5
When building a project that uses Maven, an error is encountered that states that Maven and JDK 5 are not compatible. However, the JDK version that was invoked is very obviously Java 6. Worse, the Maven plugin then increments the JDK version to JDK 7, which is also available on the system.
[main] $ /usr/lib/jvm/java-6-openjdk-amd64//bin/java -cp /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven-agent-1.6.jar:/usr/share/maven2/boot/classworlds.jar hudson.maven.agent.Main /usr/share/maven2/ /var/cache/jenkins/war/WEB-INF/lib/remoting-2.51.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven-interceptor-1.6.jar 56940
<===[JENKINS REMOTING CAPACITY]===>channel started
ERROR:JENKINS-18403JDK 5 not supported to run Maven; retrying with slave Java and setting compile/test properties to point to /usr/lib/jvm/java-6-openjdk-amd64/
[main] $ /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java -cp /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven-agent-1.6.jar:/usr/share/maven2/boot/classworlds.jar hudson.maven.agent.Main /usr/share/maven2/ /var/cache/jenkins/war/WEB-INF/lib/remoting-2.51.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven-interceptor-1.6.jar 34098
This is not reproducible from the command line; building a project from the same pom.xml and same maven2 build and same JDK will result in a proper build.
- is duplicated by
-
JENKINS-28481 JDK 5 not supported to run Maven since Jenkins 1.612
-
- Resolved
-
-
JENKINS-28368 Error "JDK 5 not supported to run Maven" while running Java 6
-
- Resolved
-
Again, the issue is Maven Plugin's tight integration of Jenkins and Maven. Jenkins' remoting model requires that all slaves run in compatible JRE's, and this appears to extend to Maven Project plugin builds.
While the error message appears to be outdated now,
https://github.com/jenkinsci/maven-plugin/blob/0963b19fef1cb3fbc9da2fa10649c9970b12f4a7/src/main/java/hudson/maven/AbstractMavenProcessFactory.java#L289
the basic requirement is there by design.
If you want to build projects using any JDK just like on the command line, use Freestyle projects. You'll lose the tight integration, but that's the cause of this problem anyway. Keeping this open for the outdated message, the rest is by design.
If you object to the automatic JDK upgrade implemented as a fallback, please file an improvement request that this be configurable or removed (whichever you prefer).