title: build multiple projects and clean multiple projects in a single build file with ANT
body: <p>I have a doubt, I made this build file in order to build 3 different projects</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project name="Trinity" basedir="." default="buildall"&gt;
  
     &lt;target name="project1"&gt;
          &lt;ant dir="C:/work/project1"/&gt;
     &lt;/target&gt;
  
     &lt;target name="project2" depends="project1"&gt;
          &lt;ant dir="C:/work/project2"/&gt;
     &lt;/target&gt;
  
     &lt;target name="project3" depends="project1, project2"&gt;
          &lt;ant dir="C:/work/project3"/&gt;
     &lt;/target&gt;
  
     &lt;target name="buildall" depends="project3"/&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>This is working now. But I wan to also clean the project before doing the build.</p>
  
  <p>In fact I want to acomplish this:
  C:/work/project1 ant clean build
  C:/work/project2 ant clean build
  C:/work/project3 ant clean build</p>
  
  <p>Thanks in advance.</p>
  
  <p>update: Thanks to the quick response from Alex I did a new build.xml file with the following. And I believe is working well, what do you think?.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project name="Trinity" basedir="." default="buildall"&gt;
  
     &lt;target name="project1"&gt;
          &lt;ant dir="C:/work/project1" target="clean"/&gt;
          &lt;ant dir="C:/work/project1" target="build"/&gt;
     &lt;/target&gt;
  
     &lt;target name="project2" depends="project1"&gt;
          &lt;ant dir="C:/work/project2" target="clean"/&gt;
          &lt;ant dir="C:/work/project2" target="build"/&gt;
     &lt;/target&gt;
  
     &lt;target name="project3" depends="project1, project2"&gt;
          &lt;ant dir="C:/work/project3" target="clean"/&gt;
          &lt;ant dir="C:/work/project3" target="build"/&gt;
     &lt;/target&gt;
  
     &lt;target name="buildall" depends="project3"/&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>Thanks.</p>