【问题标题】:Jenkins Project Can't Find Packages; build-project target failsJenkins 项目找不到包;构建项目目标失败
【发布时间】:2015-09-19 03:48:59
【问题描述】:

我的项目在我的本地机器上编译并运行,但在 Jenkins 上,由于找不到我的包,构建项目目标无法编译。我可以看到我认为我需要的 jar 在我的 ./bin/ 文件夹中,所以我预计类路径或我的构建项目目标会导致问题。

build.xml -> 构建项目:

<target depends="init" name="build-project">
    <echo message="${ant.project.name}: ${ant.file}" />
    <javac debug="true" debuglevel="${debuglevel}" destdir="bin" includeantruntime="false" source="${source}" target="${target}">
        <src path="src" />
        <classpath refid="sierraMadreTestScripts.classpath" />
    </javac>
</target>

关于 Jenkins 的错误消息摘录:

build-project:
 [echo] sierraMadreTestScripts: /data/builds/jenkins/workspace/build.xml
[javac] Compiling 1 source file to /data/builds/jenkins/workspace/bin
[javac] /data/builds/jenkins/workspace/src/testScripts/TranslatorWorkflow.java:3: error: package org.junit does not exist
[javac] import static org.junit.Assert.fail;
[javac]                        ^

我可以发布我的完整 build.xml、ivy.xml、ivysettings.xml 或诊断问题所需的任何其他内容。对不起,如果这真的很基本;常春藤对我来说仍然相当神秘。我正在 Eclipse 中运行我的本地项目。

【问题讨论】:

    标签: java xml jenkins ivy build.xml


    【解决方案1】:

    以下问题概述了您的问题的根本原因:

    Running ant build gives "package org.junit does not exist"

    简而言之,像 Eclipse 这样的 IDE 会自动将 junit 放入您的类路径中...... Ivy 实际上旨在帮助解决这个问题,并且正确使用它可以用来管理项目类路径的各个方面。

    我必须猜测无法访问您的构建逻辑,但看起来您正在使用单个 javac 构建代码和测试?您有一个名为“sierraMadreTestScripts.classpath”的类路径,下一个问题是它是如何创建和管理的。您的问题暗示常春藤以某种方式参与:-)

    【讨论】:

      猜你喜欢
      • 2017-09-18
      • 1970-01-01
      • 1970-01-01
      • 2012-12-07
      • 1970-01-01
      • 1970-01-01
      • 2016-10-30
      • 1970-01-01
      • 2012-06-07
      相关资源
      最近更新 更多