title: Exclude artifacts inherited from a parent POM?
body: <p>I have project B inherit from project A. In Project A, I have to copy jar file downloaded from Maven into lib folder. Project A's pom file :</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;groupId&gt;com.penguin.com.projecta&lt;/groupId&gt;
  &lt;artifactId&gt;penguin-common--pom&lt;/artifactId&gt;
  &lt;packaging&gt;pom&lt;/packaging&gt;
  &lt;version&gt;${com.penguin.common.projecta}&lt;/version&gt;
  &lt;name&gt;Penguin COMMON POM&lt;/name&gt;
  
  &lt;modules&gt;
      &lt;module&gt;projectb&lt;/module&gt;
  &lt;/modules&gt;
  
  &lt;build&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-dependency-plugin&lt;/artifactId&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;id&gt;copy-jars&lt;/id&gt;
                      &lt;phase&gt;process-sources&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;copy&lt;/goal&gt;
                      &lt;/goals&gt;
                      &lt;configuration&gt;
                          &lt;overWriteIfNewer&gt;true&lt;/overWriteIfNewer&gt;                
                          &lt;artifactItems&gt;
                              &lt;artifactItem&gt;
                                  &lt;groupId&gt;ant-contrib&lt;/groupId&gt;
                                  &lt;artifactId&gt;ant-contrib&lt;/artifactId&gt;
                                  &lt;version&gt;1.1&lt;/version&gt;
                                  &lt;type&gt;jar&lt;/type&gt;
                                  &lt;destFileName&gt;ant-contrib.jar&lt;/destFileName&gt;
                                  &lt;outputDirectory&gt;lib&lt;/outputDirectory&gt;
                              &lt;/artifactItem&gt;
                          &lt;/artifactItems&gt;
                      &lt;/configuration&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;        
      &lt;/plugins&gt;
  &lt;/build&gt;
  </code></pre>
  
  <p>When i build, maven copied jar file to lib folder but it also create lib folder in Project B and copy jar file defined in Project A's pom file into it. Now i want to exclude it in project B. I tried with this script below but it doesn't work.</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.penguin.com.projecta&lt;/groupId&gt;
          &lt;artifactId&gt;penguin-common--pom&lt;/artifactId&gt;
          &lt;version&gt;${com.penguin.common.projecta}&lt;/version&gt;
          &lt;type&gt;pom&lt;/type&gt;
          &lt;exclusions&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;ant-contrib&lt;/groupId&gt; 
                  &lt;artifactId&gt;ant-contrib&lt;/artifactId&gt;                        
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  </code></pre>
  
  <p>I refer this link: <a href="https://stackoverflow.com/questions/2681759/is-there-anyway-to-exclude-artifacts-inherited-from-a-parent-pom">Is there anyway to exclude artifacts inherited from a parent POM?</a>. But it doesn't help me also.</p>