Running a specific target in different ant scripts in different directories

We have a large number of applications. All of them have a file build.xmllocated in the base directory of the projects. I am trying to create an ant script that will pass and cause a specific target in each of the files build.xmlin all projects.

Here are the problems:

  • Some of the projects are in deeper directories than others.
  • Only some of the projects need to be created at a time.

I tried to use subant+ antfileand determined the CSV file paths in the properties file, but that did not work. The following is what I have and the error I get.

If there is a better way to do this or you know what my problem is, please let me know! Thank!

This property is defined in the properties file. I want the user running the script to add here the path to the file, which refers to the current location of the script that they are running.

projects.to.build=

This is a sub-job task that I am trying to use in a main build script.

    <filelist
        id="projectNames"
        dir="${basedir}"
        files="${projects.to.build}"
    />

    <target name="debugAll" description="Builds all the projects listed in the projectNames.properties file.">
        <subant target="debug" antfile="${projects.to.build}">
        </subant>
    </target>

Here is the error I get when I try to run a script construct when there are projects defined in the properties file. I use the relative path. For example: .. \ Apps \ AnApp1 \ build.xml, .. \ Apps \ AnApp2 \ build.xml, .. \ OtherApps \ foo \ AnotherApp1 \ build.xml

"No Build Path Specified" (at my subant task)
0
source share
2 answers

You specified the antfile attribute , so ANT was expecting one build.xml file .


The subantenna documentation describes how you can use a set of files as a child parameter.

:

<project name="Subant demo" default="run-debug-target">
    <target name="run-debug-target">
        <subant target="debug">
            <fileset dir="." includes="**/build.xml" excludes="build.xml"/>
        </subant>
    </target>
</project>

Update

filelist:

<project name="Dry run" default="run">
    <target name="run">
        <subant target="test">
            <filelist dir="projects" files="one/build.xml,two/build.xml,three/build.xml,four/build.xml"/>
        </subant>
    </target>
</project>

:

  • //build.xml
  • //build.xml
  • //build.xml
  • //build.xml
+9

?

.

<project name="Dry run" default="run">
    <target name="run">
        <subant target="test">
            <filelist dir="projects" files="one/build.xml,two/build.xml,three/build.xml,four/build.xml"/>
        </subant>
    </target>
</project>

"" (/build.xml, two/build.xml, three/build.xml, four/build.xml) ?

-1

All Articles