I am a NetBeans user and I wanted to reduce the number of steps required to build the project. I used to have two scripts: "build.xml"(created by NetBeans) and "build-module.xml"(my script), and I tried to merge them both into a single step. I renamed "build.xml" to "xbuild.xml" and renamed "build-module.xml" to "build.xml"(so NetBeans would execute my script instead).
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<project name="BuildModules" default="default" basedir="..">
<description>Runs all of the build-module scripts</description>
<target name="clean">
<echo message="1"/>
<subant target="clean">
<fileset dir="Core" includes="xbuild.xml"/>
</subant>
<echo message="2"/>
<ant antfile="Pineapple/build.xml" target="clean"/>
<echo message="3"/>
<!--some more commands and some more echo commands which never get executed-->
</target>
</project>
This is a reduced version of the script. I depend on clean from xbuild.xml to perform the common tasks but I still need to use the name "clean" so that NetBeans will execute it. However, the ANT script runs in an eternal loop(keeps reaching steps 1 and 2, never reaches 3). I can't change the name of the script of xbuild.xml nor build.xml. Also, the question Ant build scripts, antcall, dependancies, etc did not help. How to solve this recursive problem?
EDIT: xbuild.xml only references build-impl.xml, which is a relatively automatically generated large file, that does not link back to build.xml. Pineapple/build.xml is very similar. So, it seems that it's reaching Pineapple/build.xml and going back.
Pineapple/build.xml clean target contains this:
<target name="clean">
<echo message="P1"/>
<subant target="clean">
<fileset dir="Pineapple" includes="xbuild.xml"/>
</subant>
<echo message="P2"/>
</target>
Where P1 is printed, but P2 is not. Once again Pineapple/xbuild.xml links to Pineapple/nbproject/build-impl.xml (same name as the other one, but different folder)