标签: antcall

Antcall:从另一个文件调用嵌套的ant目标

我有两个蚂蚁文件:

1)主文件

<include file="otherFile.xml" as="otherFile"/>

<target name="firstTarget">
    <antcall target="otherFile.secondTarget"/>
</target>
Run Code Online (Sandbox Code Playgroud)

2)实用程序文件

<target name="secondTarget">
    <antcall target="thirdTarget"/>
</target>

<target name="thirdTarget">
     <echo message="ok"/> 
</target>
Run Code Online (Sandbox Code Playgroud)

当我调用firstTarget它说它找不到thirdTarget.如果我改变secondTarget这种方式:

<target name="secondTarget">
    <antcall target="otherFile.thirdTarget"/>
</target>
Run Code Online (Sandbox Code Playgroud)

然后它工作.但是我不能直接使用secondTarget.因为第二个文件没有创建前缀otherFile

ant file antcall

8
推荐指数
1
解决办法
1万
查看次数

Ant:如何测试目标是否存在(如果不存在则调用它)?

我有一组构建文件,其中一些调用其他文件 - 首先导入它们.行尾构建可能具有或不具有特定目标(例如"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"目标.我怎样才能进行有条件的蚂蚁通话?

ant conditional target antcall

5
推荐指数
1
解决办法
4948
查看次数

标签 统计

ant ×2

antcall ×2

conditional ×1

file ×1

target ×1