title: maven-shade-plugin: exclude a dependency and all its transitive dependencies
body: <p>Using <code>maven-shade-plugin</code>, is there a way to exclude a dependency (which is not <code>provided</code>) <em>and all its transitive dependencies</em>?</p>
  <p>For example :</p>
  <pre><code>&lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.example&lt;/groupId&gt;
          &lt;artifactId&gt;some-artifact&lt;/artifactId&gt;
          &lt;version&gt;1.0.0-SNAPSHOT&lt;/version&gt;
      &lt;/dependency&gt;
  
      ... other dependencies
  
  &lt;/dependencies&gt;
  </code></pre>
  <p>and 1)</p>
  <pre><code>&lt;build&gt;
      &lt;plugins&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;2.3&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;artifactSet&gt;
                      &lt;includes&gt;
                          &lt;include&gt;*:*&lt;/include&gt;
                      &lt;/includes&gt;
                      &lt;excludes&gt;
                          &lt;exclude&gt;com.example:some-artifact&lt;/exclude&gt;
                      &lt;/excludes&gt;
                  &lt;/artifactSet&gt;
              &lt;/configuration&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;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  </code></pre>
  <p>or 2)</p>
  <pre><code>&lt;build&gt;
      &lt;plugins&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;2.3&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;artifactSet&gt;
                      &lt;includes&gt;
                          &lt;include&gt;*:*&lt;/include&gt;
                      &lt;/includes&gt;
                  &lt;/artifactSet&gt;
                  &lt;filters&gt;
                      &lt;filter&gt;
                          &lt;artifact&gt;com.example:some-artifact&lt;/artifact&gt;
                          &lt;excludes&gt;
                              &lt;exclude&gt;**&lt;/exclude&gt;
                          &lt;/excludes&gt;
                      &lt;/filter&gt;
                  &lt;/filters&gt;
              &lt;/configuration&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;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  </code></pre>
  <p>Those don't work.</p>
  <p>All the transitive dependencies of <code>com.example:some-artifact</code> are added to the final jar.</p>
  <p>Note that I don't want to set the scope of <code>com.example:some-artifact</code> to <code>provided</code>.</p>