已经工作了几个月的Ant junit任务突然失败,对于以前找到的类,NoClassDefFoundError.有没有办法显示在junit任务中构建的类路径?
<target name="basic-junit-test" description="Run a single JUnit test. ">
<junit printsummary="yes" fork="no" haltonfailure="yes">
<classpath>
<pathelement location="target/WEB-INF/lib/log4j-1.2.16.jar"/>
.
. many other pathelements
.
</classpath>
<test name="com.mycompany.command.TestUNLOCKACCOUNTCommand" outfile="${report.dir}/junit_test_results" />
</junit>
</target>
Run Code Online (Sandbox Code Playgroud)
我非常喜欢在我的构建顶部声明我的Ant路径并在各种任务中使用类路径引用.
to pathconvert task可用于将类路径内容打印为属性:
<path id="test.path">
<pathelement location="target/WEB-INF/lib/log4j-1.2.16.jar"/>
.
. many other pathelements
.
</path>
<target name="echo-path" description="Echo test path">
<pathconvert targetos="unix" property="test.path.unix" refid="test.path">
<echo message="Test path: ${test.path.unix}"/>
</target>
<target name="basic-junit-test" depends="echo-path" description="Run a single JUnit test. ">
<junit printsummary="yes" fork="no" haltonfailure="yes">
<classpath>
<path refid="test.path"/>
</classpath>
<test name="com.mycompany.command.TestUNLOCKACCOUNTCommand" outfile="${report.dir}/junit_test_results" />
</junit>
</target>
Run Code Online (Sandbox Code Playgroud)
刚发生在我身上:一个更简单的解决方案可能是在调试模式下运行Ant.
| 归档时间: |
|
| 查看次数: |
4531 次 |
| 最近记录: |