我正在使用Continuous IntegrationJenkins + Netbeans (Java code) + Git环境中工作。我正在尝试将Jacoco插件与Ant任务一起使用,以进行代码覆盖。我有一个版本,与默认版本(build.xml)不同。我创建了另一个,但是当我运行“compile-test” ant任务时,这就是我得到的:

compile-tests:<br>
[javac] Compiling 1 source file to C:\CITestApp\bin\classes-tests</br>
[javac] C:\CITestApp\test\citestapp\logic\CalculatorTest.java:22: error: cannot find symbol</br>
[javac]     private Calculate calculator;
[javac]             ^
[javac]   symbol:   class Calculate
[javac]   location: class CalculatorTest
[javac] C:\CITestApp\test\citestapp\logic\CalculatorTest.java:37: error: cannot find symbol
[javac]         calculator = new Calculate();
[javac]                          ^
[javac]   symbol:   class Calculate
[javac]   location: class CalculatorTest
[javac] 2 errors

BUILD FAILED
C:\CITestApp\jacocorep.xml:29: Compile failed; see the compiler error output for details.

我怎么知道这个错误是什么意思:

最佳答案

这些是我在创建的ant构建中的目标,在其中定义了将要编译的测试的类路径:
<target name="compile"> <mkdir dir="${classes.dir}"/> <javac fork="true" debug="true" srcdir="${src.dir}" destdir="${classes.dir}" classpathref="classpath" includeantruntime="false" /> </target>>



<target name="compile-tests" depends="compile"> <mkdir dir="${classes.dir}-tests"/> <javac fork="true" debug="true" srcdir="${test.dir}" destdir="${classes.dir}-tests" classpathref="classpath" includeantruntime="false"> <classpath> <pathelement location="${lib.dir}/junit-4.10.jar"/> <path refid="application"/> </classpath> </javac> </target>
我有另一个版本(这是默认项目build.xml),在其中可以编译和执行项目中的单元测试。我在项目根目录中有这两个ant构建,所以我真的不知道classpath是否正确。

我像这样在开头定义了类路径:
<path id="classpath"> <fileset dir="${lib.dir}" includes="org/osgi/**/*.jar"/> </path> <path id="application" location="{classes.dir}"/>

关于java - 如何在Jenkins中修复 “error: cannot find symbol”?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/34907274/

10-11 22:27
查看更多