Ant 是否提供了绕过依赖的方法? [英] Does Ant offer a way to bypass dependency?
问题描述
build.xml 有一个 test 和一个 build 目标.test 目标显然依赖于 build 目标.
The build.xml has a test and a build target. The test target obviously depends on the build target.
如何只运行测试目标,暂时跳过编译,而不修改 build.xml 文件?
How can I run the test target only, temporarily skipping the compilation, without modifying the build.xml file ?
我问是因为编译时间太长,并且由持续集成服务器保持最新;我正在追查单元测试的问题.
I'm asking because the compilation is too long, and kept up-to-date by a continuous integration server ; and I'm chasing after an issue with the unit tests.
推荐答案
不,你不能不修改构建文件就跳过它.
No, you can't skip it without modifying the build file.
这是我在项目中为解决此问题所做的工作.对于每个公共目标,我将创建一个在其前面带有do-"的私有目标.私有目标没有依赖,公共目标有do-"目标作为依赖.
Here is what I do in my projects to solve this issue. For every public target I will create a private target with "do-" in front of it. The private target has no dependency, and the public target has the "do-" target as a dependency.
例如:
<target name="compile" depends="init, do-compile" description="Compiles all of the source code" />
<target name="do-compile">
<javac destdir="${classes.dir}" debug="true" encoding="ISO-8859-1">
<src refid="src.path" />
<include name="*.java" />
<classpath refid="external.libraries.classpath" />
</javac>
</target>
这篇关于Ant 是否提供了绕过依赖的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!