蚂蚁传递到目标子目录中的多个build.xml文件的文件 [英] Pass ant target to multiple build.xml files in subdirectories

查看:194
本文介绍了蚂蚁传递到目标子目录中的多个build.xml文件的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有多个模块项目,每个都在自己的目录。每个模块都有自己的Ant构建文件(build.xml文件)

I have a project with multiple modules, each in its own directory. Each module has its own ant build file (build.xml)

在根目录下我已经成立了一个调用正确的顺序每个模块的构建文件一般构建文件。

In the root directory I've set up a general build file that calls the build file of each module in the right order.

<?xml version="1.0"?>
<project name="bridgedb" default="all" basedir=".">
  <target name="all">
    <ant dir="corelib"/>
    <ant dir="tools"/>
    <ant dir="makeGdb"/>
    <ant dir="cytoscape-plugin"/>
  </target>
</project>

现在每个模块还具有一个干净的目标,所以我添加这些行:

Now each module also has a "clean" target, so I add these lines:

 <target name="clean">
    <ant dir="corelib" target="clean"/>
    <ant dir="tools" target="clean"/>
    <ant dir="makeGdb" target="clean"/>
    <ant dir="cytoscape-plugin" target="clean"/>
  </target>

还有更多这样的目标。有没有办法重写构建文件,以避免这种重复?我看着为包含活动目标一个内置的属性,但我找不到它。

And there are more targets like that. Is there a way to rewrite the build file to avoid this duplication? I've looked for a built-in property that contains the active target, but I couldn't find it.

推荐答案

为什么不使用 antcall 调用一个目标引用您所有的子目录,并进行参数设置被称为目标。例如。

Why not use antcall to call a target that references all your subdirs, and parameterise the target to be called. e.g.

 <antcall target="doStuffToSubdirs">
    <!-- let's clean -->
    <param name="param1" value="clean"/>
  </antcall>

和则:

<target name="doStuffToSubdirs">
   <ant dir="corelib" target="${param1}"/>
   <ant dir="tools" target="${param1}"/>
    ...etc
</target>

所以这允许你参数化到你的子目录呼叫。如果添加一个新的子目录,你只需要该子目录添加到doStuffToSubdirs目标(我会重命名以及!)

so this allows you to parameterise the calls to your subdirs. If you add a new subdir, you only have to add that subdir to the 'doStuffToSubdirs' target (I would rename that as well!)

这篇关于蚂蚁传递到目标子目录中的多个build.xml文件的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆