1

私のjavacAnt タスクは、以下に示すようなエラーを生成します。

[javac] C:\dp\dev\trunk\MyProduct\MyUnitTest.java:109: error: cannot find symbol
[javac]     private MyClass createFactoryMock() throws Exception {
[javac]             ^
[javac]   symbol:   class MyClass
[javac]   location: class MyUnitTest

冗長モードでタスクを実行したところ ( ant -verbose test-compile)、タスクのクラスパス出力が見つかりましMyClassた。そこから、それがクラスパスに存在すると結論付けMyClassました。

[javac] Compiling 9 source files to C:\dp\dev\trunk\MyProduct\temp\test-build

[javac] Using modern compiler
[javac] Compilation arguments:
[javac] '-d'
[javac] 'C:\dp\dev\trunk\MyProduct\temp\test-build'
[javac] '-classpath'
[javac] '[...]C:\dp\dev\trunk\MyProduct\temp\build\MyProduct\MyClass.class[...]

(クラスパスの問題以外に) 他に何がエラーの原因になる可能性がありますか?

4

2 に答える 2

0

変更して問題を修正しました

    <javac srcdir="${test}" destdir="temp/test-build" debug="${debug}" encoding="UTF-8">
        <classpath>
            [...]
            <fileset dir="${build}"/>
        </classpath>
    </javac>

    <javac srcdir="${test}" destdir="temp/test-build" debug="${debug}" encoding="UTF-8">
        <classpath>
            [...]
            <pathelement location="${build}"/>
        </classpath>
    </javac>
于 2013-09-23T07:35:44.810 に答える
0

Make it point to your exact jar files directory where the jars are present:

<path id="classpath">
    <fileset dir="${main.jar}" includes="**/*.jar"/>
    <!-- <pathelement location="${src.dir}" />-->
</path>

----in my case jar files present in ----

<property name="main.jar" value="jar"/>
于 2014-12-08T14:09:57.803 に答える