Reputation: 11
I'm building a multi-module maven project with jenkins, reported
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] Failure executing javac, but could not parse the error
Fatal Error: Unable to find package java.lang in classpath or bootclasspath.
Java version
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)
Maven version
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-11T00:41:47+08:00)
Maven home: /home/local/apache-maven-3.3.9
Java version: 1.7.0_79, vendor: Oracle Corporation
Java home: /home/local/jdk1.7.0_79/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-431.el6.x86_64", arch: "amd64", family: "unix"
Pom.xml
<repositories>
<repository>
<id>nexus</id>
<name>Team Nexus Repository</name>
<url>http://192.168.0.252:8081/nexus/content/groups/public</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<name>Team Nexus Repository</name>
<url>http://192.168.0.252:8081/nexus/content/groups/public</url>
</pluginRepository>
</pluginRepositories>
<distributionManagement>
<repository>
<id>nexus-releases</id>
<url>http://192.168.0.252:8081/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>nexus-snapshots</id>
<url>http://192.168.0.252:8081/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
Linux CLASSPATH
.:/home/local/jdk1.7.0_79/lib/dt.jar:/home/local/jdk1.7.0_79/lib/tools.jar
I think it is jdk configuration problems, but jdk environment variable should be correct. Jenkins Environment Variables:
Any help would be appreciated.
Upvotes: 0
Views: 8810
Reputation: 23
You need to consider three below things to solve this issue:
Jenkins:
Java: - Check the JAVA_HOME file version and add the JDK version accordingly everywhere.
Maven:
Upvotes: 0
Reputation: 353
Open "configure system" page in Jenkins, add JDK and path in JDK section, also you may need add JAVA_HOME to "Global Properties - Environment Variables".
Upvotes: 1