views:

23

answers:

1

The limitation I'm referring to is documented here.

Essentially, in my build script if I want to do a clean, build and then another clean I'm hitting an issue because Ant considers the clean task already complete.

Here is my ant;

<!-- ============================================================= -->
<!-- Clean up directories                                          -->
<!-- ============================================================= -->
<target name="clean">
    <delete dir="${dir.build}"/>
    <delete dir="${dir.src}"/>
</target>

<!-- ============================================================= -->
<!-- Clean up ALL directories                                      -->
<!-- ============================================================= -->
<target name="clean-all" depends="clean">
    <delete dir="${dir.war}"/>
    <delete dir="${dir.docs}"/>
</target>

<!-- ============================================================= -->
<!-- Clean-build target                                            -->
<!-- ============================================================= -->
<target name="build-clean" 
        depends=
        "build,
        clean"
>
</target>

<!-- ============================================================= -->
<!-- Production target, cleans everything prior to build           -->
<!-- ============================================================= -->
<target name="build-production" 
        depends=
        "clean-all,
        build-clean"
>
</target>

Build-production is the target I'm trying to correct, is there anyway to have it clean twice without creating another clean task or explicitly writing clean-all to delete the directories listed in clean?

+1  A: 

Why not use antcall to explicitly call the clean target again as the final stage of your build-production target ?

Brian Agnew
Because I've never seen that before. Thanks for pointing that out Brian.
James McMahon