Jenkins无法构建maven项目(无法找到工件com.sun:tools:jar:1.5.0)

Pau*_*est 2 hudson maven-3 jenkins

1)我创建了"Build a maven2/3 project"类型的新工作.

在Jenkins上构建失败,需要工具:jar:1.5.0,但是这个项目使用Java SE 6(即java 1.6)

Caused by: org.sonatype.aether.transfer.ArtifactNotFoundException: Could not find artifact com.sun:tools:jar:1.5.0 at specified path D:\Jenkins\jre/../lib/tools.jar
    at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:260)
    ... 34 more
Run Code Online (Sandbox Code Playgroud)

我使用的是最新版本:jenkins 1.421,maven 3.0.3

更新:Maven pom说使用1.6.没有使用1.5的意图

        <plugin> <!-- http://maven.apache.org/plugins/maven-compiler-plugin/ -->
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>
Run Code Online (Sandbox Code Playgroud)

2)最后,我尝试创建"构建自由式软件项目"类型的新工作.它有效,没有这个错误.直到maven包阶段.然而,这需要更多配置,我现在不知道.而我不能让詹金斯页面上打包的结果.

更新:解决了!需要在Jenkins配置中添加JDK(与JAVA_HOME相同)

khm*_*ise 7

您尝试在1.5 JRE下运行构建,而不是Maven运行所需的JDK.你需要1.5 JDK而不仅仅是JRE!