title: Delete and generate javadoc when exporting as JAR with ANT script in Eclipse
body: <p>I have an ANT script (.xml file) for exporting a project as JAR in Eclipse. It's just the file that was generated by "export as runnable JAR", with the modification to include source code and javadoc (the doc and src folders).</p>
  
  <p>I want to modify it so that when I run the script, it first generates javadoc and then creates the file, so that javadoc is always up to date in the JAR without requiring a bunch of extra clicks. Also, if a class or package is removed or moved or changes name, when I generate javadoc in Eclipse the old doc files that are not overwritten stay in the doc folder, so to ensure that the documentation in the JAR is truly up to date I want the ANT script to delete the doc folder, then generate javadoc, then create the JAR.</p>
  
  <p>Here's the script:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;
  &lt;!DOCTYPE xml&gt;
  &lt;project default="create_run_jar" name="Create Runnable Jar for Project PROJECTNAME with Jar-in-Jar Loader"&gt;
      &lt;!--this file was created by Eclipse Runnable JAR file Export Wizard--&gt;
      &lt;!--ANT 1.7 is required--&gt;
      &lt;!--define folder properties--&gt;
      &lt;property name="dir.buildfile" value="."/&gt;
      &lt;property name="dir.workspace" value="${dir.buildfile}/.."/&gt;
      &lt;property name="dir.jarfile" value="../../project_jars"/&gt;
      &lt;target name="create_run_jar"&gt;
          &lt;jar destfile="${dir.jarfile}/JARNAME.jar"&gt;
              &lt;manifest&gt;
                  &lt;attribute name="Main-Class" value="org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader"/&gt;
                  &lt;attribute name="Rsrc-Main-Class" value="PACKAGENAME.CLASSNAME"/&gt;
                  &lt;attribute name="Class-Path" value="."/&gt;
                  &lt;attribute name="Rsrc-Class-Path" value="./ opencsv-3.9.jar"/&gt;
              &lt;/manifest&gt;
              &lt;zipfileset src="jar-in-jar-loader.zip"/&gt;
              &lt;fileset dir="${dir.buildfile}/bin"/&gt;
              &lt;fileset dir="${dir.buildfile}" includes="doc/**"/&gt;
              &lt;fileset dir="${dir.buildfile}" includes="src/**"/&gt;
              &lt;zipfileset dir="../../libraries" includes="opencsv-3.9.jar"/&gt;
          &lt;/jar&gt;
      &lt;/target&gt;
  &lt;/project&gt;
  </code></pre>