title: How to exclude package in jar by editing pom.xml?
body: <p>I'm trying to exclude a package in the jar(maven dependency) by editing pom.xml</p>
  
  <p>So I tried some ways that adding  tag in the , using maven-shade-plugin, and using maven-jar-plugin.
  But it didn't work. Package in the jar still exists.</p>
  
  <p>Here're codes I tried. Thanks.
  <strong>artifact</strong> is jar name, <strong>com.domain.package</strong> is package to delete form jar. </p>
  
  <pre><code>&lt;!-- first trial --&gt;
  &lt;dependencies&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;Group&lt;/groupId&gt;
      &lt;artifactId&gt;artifact&lt;/artifactId&gt;
      &lt;version&gt;1.0&lt;/version&gt;
      &lt;scope&gt;system&lt;/scope&gt;
      &lt;systemPath&gt;${basedir}/src/main/webapp/WEB-INF/lib/artifact.jar&lt;/systemPath&gt;
  
      &lt;exclusions&gt;
        &lt;exclusion&gt;
       &lt;groupId&gt;com.domain.package&lt;/groupId&gt;
       &lt;artifactId&gt;package&lt;/artifactId&gt;
        &lt;/exclusion&gt;
      &lt;/exclusions&gt;
     &lt;/dependency&gt;
  &lt;/dependencies&gt;
  
  &lt;!-- second trial --&gt;
  &lt;plugin&gt;
     &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
     &lt;artifactId&gt;maven-shade-plugin&lt;/artifactId&gt;
     &lt;version&gt;3.2.1&lt;/version&gt;
     &lt;executions&gt;
        &lt;execution&gt;
           &lt;phase&gt;package&lt;/phase&gt;
           &lt;goals&gt;
              &lt;goal&gt;shade&lt;/goal&gt;
           &lt;/goals&gt;
           &lt;configuration&gt;
              &lt;artifactSet&gt;
                 &lt;excludes&gt;                            
                    &lt;exclude&gt;artifact:com.domain.package&lt;/exclude&gt;
                 &lt;/excludes&gt;
              &lt;/artifactSet&gt;
           &lt;/configuration&gt;
        &lt;/execution&gt;
     &lt;/executions&gt;
  &lt;/plugin&gt;
  
  &lt;!-- third trial --&gt;
  &lt;plugin&gt;
     &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
     &lt;artifactId&gt;maven-jar-plugin&lt;/artifactId&gt;
     &lt;version&gt;2.4&lt;/version&gt;
     &lt;executions&gt;
        &lt;execution&gt;
           &lt;id&gt;artifact&lt;/id&gt;
           &lt;phase&gt;package&lt;/phase&gt;
           &lt;goals&gt;
              &lt;goal&gt;jar&lt;/goal&gt;
           &lt;/goals&gt;
           &lt;configuration&gt;
              &lt;excludes&gt;
                 &lt;exclude&gt;**/com/domain/package/*&lt;/exclude&gt;
              &lt;/excludes&gt;
           &lt;/configuration&gt;
        &lt;/execution&gt;
     &lt;/executions&gt;
  &lt;/plugin&gt;
  </code></pre>