难道蚂蚁提供了一种方法来绕过依赖? [英] Does Ant offer a way to bypass dependency?
问题描述
中的build.xml有一个的测试的和的建立的目标。该的测试的目标显然取决于的建立的目标。
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.
下面是我在我的项目做来解决这个问题。
对于每一个公共的目标,我将创建在它前面的做 - 私人目标。
私人目标没有相关性,而公共目标有做 - 目标作为一个依赖。
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>
这篇关于难道蚂蚁提供了一种方法来绕过依赖?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!