Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
831 views
in Technique[技术] by (71.8m points)

intellij idea - Intermodule dependency in ant

I am using Ant 1.8

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.

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.

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

Please suggest an approach using basic Ant features.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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>

Project structure

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

Note:

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...