Generate Ant build file

Posted by inakiabt on Stack Overflow See other posts from Stack Overflow or by inakiabt
Published on 2009-09-24T04:33:24Z Indexed on 2011/01/05 1:53 UTC
Read the original article Hit count: 607

Filed under:
|
|
|
|

I have the following project structure:

root/
    comp/
        env/
           version/
                  build.xml
           build.xml
        build.xml

Where root/comp/env/version/build.xml is:

<project name="comp-env-version" basedir=".">
    <import file="../build.xml" optional="true" />
    <echo>Comp Env Version tasks</echo>
    <target name="run">
        <echo>Comp Env Version run task</echo>
    </target>
</project>

root/comp/env/build.xml is:

<project name="comp-env" basedir=".">
    <import file="../build.xml" optional="true" />
    <echo>Comp Env tasks</echo>
    <target name="run">
        <echo>Comp Env run task</echo>
    </target>
</project>

root/comp/build.xml is:

<project name="comp" basedir=".">
    <echo>Comp tasks</echo>
</project>

Each build file imports the parent build file and each child inherits and overrides parent tasks/properties.

What I need is to get the generated build XML without run anything.

For example, if I run "ant" (or something like that) on root/comp/env/version/, I would like to get the following output:

<project name="comp-env-version" basedir=".">
    <echo>Comp tasks</echo>
    <echo>Comp Env tasks</echo>
    <echo>Comp Env Version tasks</echo>
    <target name="run">
        <echo>Comp Env Version run task</echo>
    </target>
</project>

Is there an Ant plugin to do this? With Maven? What are my options if not?

EDIT: I need something like "mvn help:effective-pom" for Ant.

© Stack Overflow or respective owner

Related posts about java

Related posts about Xml