title: How to delete a file while doing maven install (build) from target directory
body: <p>I am looking to delete a folder (api-docs) from the target folder. When I do maven build, when the target folder is generated, it should exclude that folder(api-docs). <br> Target contains Classes, codegen, generated-sources, javadoc-bundle-options, maven-archiver, maven-status, test-classes and a war file. <br> I need to exclude(api-docs) which is present in codegen <br> Codegen > generated-sources> web> api-docs( contains css, fonts, images, lang, lib, specs and some other js and html files)<br> </p>
  
  <pre><code> &lt;plugin&gt;
                           &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                          &lt;artifactId&gt;maven-antrun-plugin&lt;/artifactId&gt;
                          &lt;version&gt;1.8&lt;/version&gt;
                          &lt;executions&gt;
                              &lt;execution&gt;
                                  &lt;phase&gt;build&lt;/phase&gt;
                                  &lt;goals&gt;
                                      &lt;goal&gt;build&lt;/goal&gt;
                                  &lt;/goals&gt;
                                  &lt;configuration&gt;                                  
                                      &lt;tasks&gt;
                                          &lt;delete&gt;
                                            &lt;fileset&gt; dir="${project.build.outputDirectory}/target/codegen/generated-sources/web/api-docs"/&gt;
                                          &lt;/delete&gt;
                                      &lt;/tasks&gt;
                                  &lt;/configuration&gt;
                              &lt;/execution&gt;
                          &lt;/executions&gt;
                      &lt;/plugin&gt;  
            `
  </code></pre>
  
  <p><br>I added that in pom.xml, but couldn't able to delete. Please suggest<br>
  Here is the entire contents of build from pom file<br></p>
  
  <pre><code>&lt;build&gt; 
  &lt;pluginManagement&gt;
  &lt;plugins&gt;
  &lt;plugin&gt;
  &lt;groupId&gt;com.xxx.chassis.api.plugins&lt;/groupId&gt;
  &lt;artifactId&gt;codegen-maven-plugin&lt;/artifactId&gt;
  &lt;version&gt;${codegen.plugin.version}&lt;/version&gt;
  &lt;executions&gt;
  &lt;execution&gt;
  &lt;phase&gt;generate-sources&lt;/phase&gt;
  &lt;goals&gt;
  &lt;goal&gt;generate&lt;/goal&gt;
  &lt;/goals&gt;
  &lt;/execution&gt;
  &lt;/executions&gt;
  &lt;configuration&gt;
  &lt;templateDir&gt;chassis-archetypes&lt;/templateDir&gt;
  &lt;configFile&gt;${project.parent.basedir}/codegen-config.yaml&lt;/configFile&gt;
  &lt;specifications&gt;
  &lt;specification&gt;${project.parent.basedir}/partnerships-originations-product-offer-id.yaml&lt;/specification&gt;
  &lt;/specifications&gt;
  &lt;basePackage&gt;com.xxx.papi.popoi&lt;/basePackage&gt;
  &lt;/configuration&gt;
  &lt;/plugin&gt; 
  
             &lt;plugin&gt;
                       &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                      &lt;artifactId&gt;maven-antrun-plugin&lt;/artifactId&gt;
                      &lt;version&gt;1.8&lt;/version&gt;
                      &lt;executions&gt;
                          &lt;execution&gt;
                              &lt;phase&gt;build&lt;/phase&gt;
                              &lt;goals&gt;
                                  &lt;goal&gt;run&lt;/goal&gt;
                              &lt;/goals&gt;
                              &lt;configuration&gt;                                  
                                  &lt;tasks&gt;
                                      &lt;delete&gt;
                                        &lt;fileset dir="${project.build.directory}/codegen/generated-sources/web/api-docs/swagger-ui.min.js"/&gt;
                                      &lt;/delete&gt;
                                  &lt;/tasks&gt;
                              &lt;/configuration&gt;
                          &lt;/execution&gt;
                      &lt;/executions&gt;
                  &lt;/plugin&gt;  
  
  &lt;plugin&gt;
  &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
  &lt;artifactId&gt;build-helper-maven-plugin&lt;/artifactId&gt;
  &lt;executions&gt;
  &lt;execution&gt;
  &lt;id&gt;add-source&lt;/id&gt;
  &lt;phase&gt;generate-sources&lt;/phase&gt;
  &lt;goals&gt;
  &lt;goal&gt;add-source&lt;/goal&gt;
  &lt;/goals&gt;
  &lt;configuration&gt;
  &lt;sources&gt;
  &lt;source&gt;${codegen.generated-sources}/java&lt;/source&gt;
  &lt;/sources&gt;
  &lt;/configuration&gt;
  &lt;/execution&gt;
  &lt;/executions&gt;
  &lt;/plugin&gt;
  &lt;plugin&gt;
  &lt;artifactId&gt;maven-javadoc-plugin&lt;/artifactId&gt;
  &lt;configuration&gt;
  &lt;sourcepath&gt;${codegen.generated-sources}/java&lt;/sourcepath&gt;
  &lt;/configuration&gt;
  &lt;/plugin&gt;
  &lt;/plugins&gt;
  &lt;/pluginManagement&gt;
  &lt;/build&gt;
  </code></pre>