4
我想設置Ant來運行我的測試,但是我的測試無法編譯。 錯誤在於它無法找到正在測試的類,即使我將它們放在類路徑中。我什至輸出類路徑,他們在上面。Ant:把類放在類路徑上,但它們不被看到
螞蟻:
<target name="compile">
<echo>compiling code</echo>
<javac debug="true" srcdir="${src}" destdir="${build}" classpathref="build.path" />
<echo>compiling tests</echo>
<echo message="${toString:build.test.path}" />
<javac debug="true" srcdir="${test}" destdir="${build.test}" classpathref="build.test.path" />
</target>
<path id="build.test.path">
<fileset dir="${build}">
<include name="**/*.class"/>
</fileset>
<fileset dir="${install}">
<include name="junit-4.11.jar"/>
</fileset>
</path>
這是控制檯輸出:
compile:
[echo] compiling code
[javac] C:\PetProjects\timesheet\build.xml:37: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 2 source files to C:\PetProjects\timesheet\build
[echo]
[echo]
[echo] compiling tests
[echo]
[echo]
[echo] C:\PetProjects\timesheet\build\com\me\timesheet\exceptions\BadBlockException.class;C:\PetProjects\timesheet\build\com\me\timesheet\pojo\Block.class;C:\Installations\junit-4.11.jar
[echo]
[echo]
[javac] C:\PetProjects\timesheet\build.xml:47: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 1 source file to C:\PetProjects\timesheet\build-test
[javac] C:\PetProjects\timesheet\test\com\me\timesheet\pojo\BlockTest.java:9: cannot find symbol
[javac] symbol : class Block
[javac] location: package com.me.timesheet.pojo
[javac] import com.me.timesheet.pojo.Block;
[javac] ^
[javac] C:\PetProjects\timesheet\test\com\me\timesheet\pojo\BlockTest.java:11: package com.me.timesheet.exceptions does not exist
[javac] import com.me.timesheet.exceptions.BadBlockException;