ant 中的模块间依赖 [英] Intermodule dependency in ant

查看:31
本文介绍了ant 中的模块间依赖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 Ant 1.8

I am using Ant 1.8

我在 intelliJ IDEA 中有多个模块.每个模块都有一个 build.xml,目前我需要浏览到该文件的 build.xml 并为每个模块运行 ant.例如模块 B 的构建成功取决于模块 A 的构建是否成功.

I have multiple modules in intelliJ IDEA. Each module has a build.xml and currently i need to browse till build.xml of that file and run ant for every module. e.g. module B's build success depends on whether module A's build was successful.

现在,我想更新这个过程.如果存在一个选项,我可以编写一个单独的构建过程,该过程将首先为模块 A 构建分发,然后在为 B 构建分发时,将检查模块 A 的构建是否成功,这将是很棒的.

Now, i want to update this process. It will be great if an option exists wherein i can write a single build process which will first build distribution for module A and then while building distribution for B, it will be checked if build for module A is successful.

有没有办法使用当前的 Ant 机制.我可以在 ivy 中看到类似的东西,但我不能在我的项目中使用它.

Is there any way using current Ant mechanism. i could see something similar in ivy but i cant use it in my project.

请提出一种使用基本 Ant 功能的方法.

Please suggest an approach using basic Ant features.

推荐答案

subant ANT 中的 task 是调用多模块构建最灵活的方式,例如:

The subant task in ANT is the most flexible way to invoke a multi-module build, for example:

<project name="parent" default="build">

    <target name="build">
        <subant>
            <filelist dir=".">
                <file name="moduleA/build.xml"/>
                <file name="moduleB/build.xml"/>
            </filelist>
            <target name="clean"/>
            <target name="build"/>
        </subant>
    </target>

</project>

项目结构

|-- build.xml
|-- moduleA
|   `-- build.xml
`-- moduleB
    `-- build.xml

注意:

在我看来,使用此任务最强大的方法是将它与 buildlist 来自 Apache ivy 的任务.让 ivy 模块间依赖声明自动确定模块构建顺序.

In my opinion the most powerful way to use this task is to combine it with the buildlist task from Apache ivy. Let the ivy inter-module dependency declarations automatically determine the module build order.

这篇关于ant 中的模块间依赖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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