我有两个蚂蚁文件:
1)主文件
Run Code Online (Sandbox Code Playgroud)<include file="otherFile.xml" as="otherFile"/> <target name="firstTarget"> <antcall target="otherFile.secondTarget"/> </target>
2)实用程序文件
<target name="secondTarget">
<antcall target="thirdTarget"/>
</target>
<target name="thirdTarget">
<echo message="ok"/>
</target>
Run Code Online (Sandbox Code Playgroud)
当我调用firstTarget它说它找不到thirdTarget.如果我改变secondTarget这种方式:
Run Code Online (Sandbox Code Playgroud)<target name="secondTarget"> <antcall target="otherFile.thirdTarget"/> </target>
然后它工作.但是我不能直接使用secondTarget.因为第二个文件没有创建前缀otherFile
我有一组构建文件,其中一些调用其他文件 - 首先导入它们.行尾构建可能具有或不具有特定目标(例如"copyother").如果该目标是在行尾构建脚本中定义的,我想从我的主构建文件中调用它.我该怎么做?
部分调用脚本:
<!-- Import project-specific libraries and classpath -->
<property name="build.dir" value="${projectDir}/build"/>
<import file="${build.dir}/build_libs.xml"/>
...
<!-- "copyother" is a foreign target, imported in build_libs.xml per project -->
<target name="pre-package" depends=" clean,
init,
compile-src,
copy-src-resources,
copy-app-resources,
copyother,
compile-tests,
run-junit-tests"/>
Run Code Online (Sandbox Code Playgroud)
我不希望每个项目都定义"copyother"目标.我怎样才能进行有条件的蚂蚁通话?