2016-01-13 157 views
0

我建立与詹金斯多模块Maven项目,报詹金斯编译错误

[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版本

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版本

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 

我认为这是JDK配置的问题,而是jdk的环境变量应该是正确的。 詹金斯环境变量:

任何帮助,将不胜感激。

+0

欢迎来到StackOverflow。请将您的配置放在代码标签中,并在问题中解释问题,而不是在问题评论中。 – FunkySayu

回答

1

打开Jenkins中的“configure system”页面,在JDK部分添加JDK和路径,也可能需要将JAVA_HOME添加到“Global Properties - Environment Variables”中。

+0

我已经设置了.JAVA_HOME \t /home/local/jdk1.7.0_79环境变量 –

+0

要Jenkins?好的,现在您需要在JDK部分添加JDK和路径。你的错误发生是由于jenkins-project缺少主要设置,Jenkins不知道在哪里找到编译器。 –

+0

是,“配置系统”或“jenkins作业配置”。 –