Modified: maven/website/components/plugins-archives/maven-shade-plugin-LATEST/examples/includes-excludes.html ============================================================================== --- maven/website/components/plugins-archives/maven-shade-plugin-LATEST/examples/includes-excludes.html (original) +++ maven/website/components/plugins-archives/maven-shade-plugin-LATEST/examples/includes-excludes.html Thu Mar 24 18:14:26 2022 @@ -1,288 +1,284 @@ -<!DOCTYPE html> -<!-- - | Generated by Apache Maven Doxia Site Renderer 1.8.1 at 2021-07-14 - | Rendered using Apache Maven Fluido Skin 1.6 ---> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> - <head> - <meta charset="UTF-8" /> - <meta name="viewport" content="width=device-width, initial-scale=1.0" /> - <meta name="author" content="Mauro Talevi" /> - <meta name="Date-Creation-yyyymmdd" content="20080721" /> - <meta name="Date-Revision-yyyymmdd" content="20210714" /> - <meta http-equiv="Content-Language" content="en" /> - <title>Apache Maven Shade Plugin – Selecting Contents for Uber JAR</title> - <link rel="stylesheet" href="../css/apache-maven-fluido-1.6.min.css" /> - <link rel="stylesheet" href="../css/site.css" /> - <link rel="stylesheet" href="../css/print.css" media="print" /> - <script type="text/javascript" src="../js/apache-maven-fluido-1.6.min.js"></script> - <!-- Google Analytics --> - <script type="text/javascript"> - var _gaq = _gaq || []; - _gaq.push(['_setAccount', 'UA-140879-1']); - _gaq.push(['_trackPageview']); - (function() { - var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; - ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; - var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); - })(); - </script> - </head> - <body class="topBarDisabled"> - <div class="container-fluid"> - <div id="banner"> - <div class="pull-left"><a href="http://www.apache.org/" id="bannerLeft"><img src="http://maven.apache.org/images/apache-maven-project.png" /></a></div> - <div class="pull-right"><a href="http://maven.apache.org/" id="bannerRight"><img src="http://maven.apache.org/images/maven-logo-black-on-white.png" /></a></div> - <div class="clear"><hr/></div> - </div> - - <div id="breadcrumbs"> - <ul class="breadcrumb"> - <li class=""><a href="https://www.apache.org/" class="externalLink" title="Apache">Apache</a><span class="divider">/</span></li> - <li class=""><a href="../../../index.html" title="Maven">Maven</a><span class="divider">/</span></li> - <li class=""><a href="../../index.html" title="Plugins">Plugins</a><span class="divider">/</span></li> - <li class=""><a href="../index.html" title="Apache Maven Shade Plugin">Apache Maven Shade Plugin</a><span class="divider">/</span></li> - <li class="active ">Selecting Contents for Uber JAR</li> - <li id="publishDate" class="pull-right"><span class="divider">|</span> Last Published: 2021-07-14</li> - <li id="projectVersion" class="pull-right">Version: 3.3.1-SNAPSHOT</li> - </ul> - </div> - <div class="row-fluid"> - <div id="leftColumn" class="span2"> - <div class="well sidebar-nav"> -<ul class="nav nav-list"> - <li class="nav-header">Overview</li> - <li><a href="../index.html" title="Introduction"><span class="none"></span>Introduction</a> </li> - <li><a href="../plugin-info.html" title="Goals"><span class="none"></span>Goals</a> </li> - <li><a href="../usage.html" title="Usage"><span class="none"></span>Usage</a> </li> - <li><a href="../faq.html" title="FAQ"><span class="none"></span>FAQ</a> </li> - <li><a href="http://www.apache.org/licenses/" class="externalLink" title="License"><span class="none"></span>License</a> </li> - <li><a href="../download.html" title="Download"><span class="none"></span>Download</a> </li> - <li class="nav-header">Examples</li> - <li class="active"><a href="#"><span class="none"></span>Selecting Contents for Uber JAR</a> - </li> - <li><a href="../examples/class-relocation.html" title="Relocating Classes"><span class="none"></span>Relocating Classes</a> </li> - <li><a href="../examples/attached-artifact.html" title="Attaching the Shaded Artifact"><span class="none"></span>Attaching the Shaded Artifact</a> </li> - <li><a href="../examples/executable-jar.html" title="Executable JAR"><span class="none"></span>Executable JAR</a> </li> - <li><a href="../examples/resource-transformers.html" title="Resource Transformers"><span class="none"></span>Resource Transformers</a> </li> - <li><a href="../examples/use-shader-other-impl.html" title="Using another Shader implementation"><span class="none"></span>Using another Shader implementation</a> </li> - <li class="nav-header">Project Documentation</li> - <li><a href="../project-info.html" title="Project Information"><span class="icon-chevron-right"></span>Project Information</a> </li> - <li><a href="../project-reports.html" title="Project Reports"><span class="icon-chevron-right"></span>Project Reports</a> </li> - <li class="nav-header">Maven Projects</li> - <li><a href="../../../archetype/index.html" title="Archetype"><span class="none"></span>Archetype</a> </li> - <li><a href="../../../resolver/index.html" title="Artifact Resolver"><span class="none"></span>Artifact Resolver</a> </li> - <li><a href="../../../doxia/index.html" title="Doxia"><span class="none"></span>Doxia</a> </li> - <li><a href="../../../jxr/index.html" title="JXR"><span class="none"></span>JXR</a> </li> - <li><a href="../../../ref/current" title="Maven"><span class="none"></span>Maven</a> </li> - <li><a href="../../../pom/index.html" title="Parent POMs"><span class="none"></span>Parent POMs</a> </li> - <li><a href="../../index.html" title="Plugins"><span class="none"></span>Plugins</a> </li> - <li><a href="../../../plugin-testing/index.html" title="Plugin Testing"><span class="none"></span>Plugin Testing</a> </li> - <li><a href="../../../plugin-tools/index.html" title="Plugin Tools"><span class="none"></span>Plugin Tools</a> </li> - <li><a href="../../../apache-resource-bundles/index.html" title="Resource Bundles"><span class="none"></span>Resource Bundles</a> </li> - <li><a href="../../../scm/index.html" title="SCM"><span class="none"></span>SCM</a> </li> - <li><a href="../../../shared/index.html" title="Shared Components"><span class="none"></span>Shared Components</a> </li> - <li><a href="../../../skins/index.html" title="Skins"><span class="none"></span>Skins</a> </li> - <li><a href="../../../surefire/index.html" title="Surefire"><span class="none"></span>Surefire</a> </li> - <li><a href="../../../wagon/index.html" title="Wagon"><span class="none"></span>Wagon</a> </li> - <li class="nav-header">ASF</li> - <li><a href="https://www.apache.org/foundation/how-it-works.html" class="externalLink" title="How Apache Works"><span class="none"></span>How Apache Works</a> </li> - <li><a href="https://www.apache.org/foundation/" class="externalLink" title="Foundation"><span class="none"></span>Foundation</a> </li> - <li><a href="https://www.apache.org/foundation/sponsorship.html" class="externalLink" title="Sponsoring Apache"><span class="none"></span>Sponsoring Apache</a> </li> - <li><a href="https://www.apache.org/foundation/thanks.html" class="externalLink" title="Thanks"><span class="none"></span>Thanks</a> </li> - </ul> -<form id="search-form" action="https://www.google.com/search" method="get" > - <input value="$sitesearchValue" name="sitesearch" type="hidden"/> - <input class="search-query" name="q" id="query" type="text" /> -</form> -<script type="text/javascript">asyncJs( 'https://cse.google.com/brand?form=search-form' )</script> - <hr /> - <div id="poweredBy"> - <script type="text/javascript">asyncJs( 'https://apis.google.com/js/plusone.js' )</script> - <div class="g-plusone" data-href="https://maven.apache.org/plugins/maven-shade-plugin/" data-size="tall" ></div> - <div class="clear"></div> - <div class="clear"></div> - <div id="twitter"> - <a href="https://twitter.com/ASFMavenProject" class="twitter-follow-button" data-show-count="false" data-align="left" data-size="medium" data-show-screen-name="true" data-lang="en">Follow ASFMavenProject</a> - <script type="text/javascript">!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script> - </div> - <div class="clear"></div> - <div class="clear"></div> - <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy"><img class="builtBy" alt="Built by Maven" src="../images/logos/maven-feather.png" /></a> - </div> - </div> - </div> - <div id="bodyColumn" class="span10" > -<div class="section"> -<h2><a name="Selecting_Contents_for_Uber_JAR"></a>Selecting Contents for Uber JAR</h2> -<p>The POM snippet below shows how to control which project dependencies should be included/excluded in the uber JAR:</p> -<div class="source"><pre class="prettyprint linenums"><project> - ... - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-shade-plugin</artifactId> - <version>3.3.1-SNAPSHOT</version> - <executions> - <execution> - <phase>package</phase> - <goals> - <goal>shade</goal> - </goals> - <configuration> - <artifactSet> - <excludes> - <exclude>classworlds:classworlds</exclude> - <exclude>junit:junit</exclude> - <exclude>jmock:*</exclude> - <exclude>*:xml-apis</exclude> - <exclude>org.apache.maven:lib:tests</exclude> - <exclude>log4j:log4j:jar:</exclude> - </excludes> - </artifactSet> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> - ... -</project> -</pre></div> -<p>Of course, <tt><includes></tt> can be used as well to specify a white list of artifacts. Artifacts are denoted by a composite identifier of the form <i>groupId</i>:<i>artifactId</i>[[:<i>type</i>]:<i>classifier</i>]. Since plugin version 1.3, the wildcard characters '*' and '?' can be used to do glob-like pattern matching.</p> -<p>For fine-grained control of which classes from the selected dependencies are included, artifact filters can be used:</p> -<div class="source"><pre class="prettyprint linenums"><project> - ... - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-shade-plugin</artifactId> - <version>3.3.1-SNAPSHOT</version> - <executions> - <execution> - <phase>package</phase> - <goals> - <goal>shade</goal> - </goals> - <configuration> - <filters> - <filter> - <artifact>junit:junit</artifact> - <includes> - <include>junit/framework/**</include> - <include>org/junit/**</include> - </includes> - <excludes> - <exclude>org/junit/experimental/**</exclude> - <exclude>org/junit/runners/**</exclude> - </excludes> - </filter> - <filter> - <artifact>*:*</artifact> - <excludes> - <exclude>META-INF/*.SF</exclude> - <exclude>META-INF/*.DSA</exclude> - <exclude>META-INF/*.RSA</exclude> - </excludes> - </filter> - </filters> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> - ... -</project> -</pre></div> -<p>Here, Ant-like patterns are used to specify that from the dependency <tt>junit:junit</tt> only certain classes/resources should be included in the uber JAR. The second filter demonstrates the use of wildcards for the artifact identity which was introduced in plugin version 1.3. It excludes all signature related files from every artifact, regardless of its group or artifact id.</p> -<p>Besides user-specified filters, the plugin can also be configured to automatically remove all classes of dependencies that are not used by the project, thereby minimizing the resulting uber JAR:</p> -<div class="source"><pre class="prettyprint linenums"><project> - ... - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-shade-plugin</artifactId> - <version>3.3.1-SNAPSHOT</version> - <executions> - <execution> - <phase>package</phase> - <goals> - <goal>shade</goal> - </goals> - <configuration> - <minimizeJar>true</minimizeJar> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> - ... -</project> -</pre></div> -<p>As of version 1.6, minimizeJar will respect classes that were specifically marked for inclusion in a filter. Note that specifying an include filter for classes in an artifact implicitly excludes all non-specified classes in that artifact. <tt><excludeDefaults>false<\excludeDefaults></tt> will override this behavior so that all non-specified classes still will be included though.</p> -<div class="source"><pre class="prettyprint linenums"><project> - ... - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-shade-plugin</artifactId> - <version>3.3.1-SNAPSHOT</version> - <executions> - <execution> - <phase>package</phase> - <goals> - <goal>shade</goal> - </goals> - <configuration> - <minimizeJar>true</minimizeJar> - <filters> - <filter> - <artifact>log4j:log4j</artifact> - <includes> - <include>**</include> - </includes> - </filter> - <filter> - <artifact>commons-logging:commons-logging</artifact> - <includes> - <include>**</include> - </includes> - </filter> - <filter> - <artifact>foo:bar</artifact> - <excludeDefaults>false</excludeDefaults> - <includes> - <include>foo/Bar.class</include> - </includes> - </filter> - </filters> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> - ... -</project> -</pre></div></div> - </div> - </div> - </div> - <hr/> - <footer> - <div class="container-fluid"> - <div class="row-fluid"> - <p>Copyright ©2002–2021 -<a href="https://www.apache.org/">The Apache Software Foundation</a>. -All rights reserved.</p> - </div> - </div> - </footer> - </body> +<!DOCTYPE html> +<!-- + | Generated by Apache Maven Doxia Site Renderer 1.8.1 at 2022-03-24 + | Rendered using Apache Maven Fluido Skin 1.6 +--> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <meta charset="UTF-8" /> + <meta name="viewport" content="width=device-width, initial-scale=1.0" /> + <meta name="author" content="Mauro Talevi" /> + <meta name="Date-Creation-yyyymmdd" content="20080721" /> + <meta name="Date-Revision-yyyymmdd" content="20220324" /> + <meta http-equiv="Content-Language" content="en" /> + <title>Apache Maven Shade Plugin – Selecting Contents for Uber JAR</title> + <link rel="stylesheet" href="../css/apache-maven-fluido-1.6.min.css" /> + <link rel="stylesheet" href="../css/site.css" /> + <link rel="stylesheet" href="../css/print.css" media="print" /> + <script type="text/javascript" src="../js/apache-maven-fluido-1.6.min.js"></script> + <!-- Google Analytics --> + <script type="text/javascript"> + var _gaq = _gaq || []; + _gaq.push(['_setAccount', 'UA-140879-1']); + _gaq.push(['_trackPageview']); + (function() { + var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; + ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; + var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); + })(); + </script> + </head> + <body class="topBarDisabled"> + <div class="container-fluid"> + <div id="banner"> + <div class="pull-left"><a href="http://www.apache.org/" id="bannerLeft"><img src="http://maven.apache.org/images/apache-maven-project.png" /></a></div> + <div class="pull-right"><a href="http://maven.apache.org/" id="bannerRight"><img src="http://maven.apache.org/images/maven-logo-black-on-white.png" /></a></div> + <div class="clear"><hr/></div> + </div> + + <div id="breadcrumbs"> + <ul class="breadcrumb"> + <li class=""><a href="https://www.apache.org/" class="externalLink" title="Apache">Apache</a><span class="divider">/</span></li> + <li class=""><a href="../../../index.html" title="Maven">Maven</a><span class="divider">/</span></li> + <li class=""><a href="../../index.html" title="Plugins">Plugins</a><span class="divider">/</span></li> + <li class=""><a href="../index.html" title="Apache Maven Shade Plugin">Apache Maven Shade Plugin</a><span class="divider">/</span></li> + <li class="active ">Selecting Contents for Uber JAR</li> + <li id="publishDate" class="pull-right"><span class="divider">|</span> Last Published: 2022-03-24</li> + <li id="projectVersion" class="pull-right">Version: 3.3.0</li> + </ul> + </div> + <div class="row-fluid"> + <div id="leftColumn" class="span2"> + <div class="well sidebar-nav"> +<ul class="nav nav-list"> + <li class="nav-header">Overview</li> + <li><a href="../index.html" title="Introduction"><span class="none"></span>Introduction</a> </li> + <li><a href="../plugin-info.html" title="Goals"><span class="none"></span>Goals</a> </li> + <li><a href="../usage.html" title="Usage"><span class="none"></span>Usage</a> </li> + <li><a href="../faq.html" title="FAQ"><span class="none"></span>FAQ</a> </li> + <li><a href="http://www.apache.org/licenses/" class="externalLink" title="License"><span class="none"></span>License</a> </li> + <li><a href="../download.html" title="Download"><span class="none"></span>Download</a> </li> + <li class="nav-header">Examples</li> + <li class="active"><a href="#"><span class="none"></span>Selecting Contents for Uber JAR</a> + </li> + <li><a href="../examples/class-relocation.html" title="Relocating Classes"><span class="none"></span>Relocating Classes</a> </li> + <li><a href="../examples/attached-artifact.html" title="Attaching the Shaded Artifact"><span class="none"></span>Attaching the Shaded Artifact</a> </li> + <li><a href="../examples/executable-jar.html" title="Executable JAR"><span class="none"></span>Executable JAR</a> </li> + <li><a href="../examples/resource-transformers.html" title="Resource Transformers"><span class="none"></span>Resource Transformers</a> </li> + <li><a href="../examples/use-shader-other-impl.html" title="Using another Shader implementation"><span class="none"></span>Using another Shader implementation</a> </li> + <li class="nav-header">Project Documentation</li> + <li><a href="../project-info.html" title="Project Information"><span class="icon-chevron-right"></span>Project Information</a> </li> + <li><a href="../project-reports.html" title="Project Reports"><span class="icon-chevron-right"></span>Project Reports</a> </li> + <li class="nav-header">Maven Projects</li> + <li><a href="../../../archetype/index.html" title="Archetype"><span class="none"></span>Archetype</a> </li> + <li><a href="../../../resolver/index.html" title="Artifact Resolver"><span class="none"></span>Artifact Resolver</a> </li> + <li><a href="../../../doxia/index.html" title="Doxia"><span class="none"></span>Doxia</a> </li> + <li><a href="../../../jxr/index.html" title="JXR"><span class="none"></span>JXR</a> </li> + <li><a href="../../../ref/current" title="Maven"><span class="none"></span>Maven</a> </li> + <li><a href="../../../pom/index.html" title="Parent POMs"><span class="none"></span>Parent POMs</a> </li> + <li><a href="../../index.html" title="Plugins"><span class="none"></span>Plugins</a> </li> + <li><a href="../../../plugin-testing/index.html" title="Plugin Testing"><span class="none"></span>Plugin Testing</a> </li> + <li><a href="../../../plugin-tools/index.html" title="Plugin Tools"><span class="none"></span>Plugin Tools</a> </li> + <li><a href="../../../apache-resource-bundles/index.html" title="Resource Bundles"><span class="none"></span>Resource Bundles</a> </li> + <li><a href="../../../scm/index.html" title="SCM"><span class="none"></span>SCM</a> </li> + <li><a href="../../../shared/index.html" title="Shared Components"><span class="none"></span>Shared Components</a> </li> + <li><a href="../../../skins/index.html" title="Skins"><span class="none"></span>Skins</a> </li> + <li><a href="../../../surefire/index.html" title="Surefire"><span class="none"></span>Surefire</a> </li> + <li><a href="../../../wagon/index.html" title="Wagon"><span class="none"></span>Wagon</a> </li> + <li class="nav-header">ASF</li> + <li><a href="https://www.apache.org/foundation/how-it-works.html" class="externalLink" title="How Apache Works"><span class="none"></span>How Apache Works</a> </li> + <li><a href="https://www.apache.org/foundation/" class="externalLink" title="Foundation"><span class="none"></span>Foundation</a> </li> + <li><a href="https://www.apache.org/foundation/sponsorship.html" class="externalLink" title="Sponsoring Apache"><span class="none"></span>Sponsoring Apache</a> </li> + <li><a href="https://www.apache.org/foundation/thanks.html" class="externalLink" title="Thanks"><span class="none"></span>Thanks</a> </li> + </ul> +<form id="search-form" action="https://www.google.com/search" method="get" > + <input value="$sitesearchValue" name="sitesearch" type="hidden"/> + <input class="search-query" name="q" id="query" type="text" /> +</form> +<script type="text/javascript">asyncJs( 'https://cse.google.com/brand?form=search-form' )</script> + <hr /> + <div id="poweredBy"> + <script type="text/javascript">asyncJs( 'https://apis.google.com/js/plusone.js' )</script> + <div class="g-plusone" data-href="https://maven.apache.org/plugins/maven-shade-plugin/" data-size="tall" ></div> + <div class="clear"></div> + <div class="clear"></div> + <div id="twitter"> + <a href="https://twitter.com/ASFMavenProject" class="twitter-follow-button" data-show-count="false" data-align="left" data-size="medium" data-show-screen-name="true" data-lang="en">Follow ASFMavenProject</a> + <script type="text/javascript">!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script> + </div> + <div class="clear"></div> + <div class="clear"></div> + <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy"><img class="builtBy" alt="Built by Maven" src="../images/logos/maven-feather.png" /></a> + </div> + </div> + </div> + <div id="bodyColumn" class="span10" > +<div class="section"> +<h2><a name="Selecting_Contents_for_Uber_JAR"></a>Selecting Contents for Uber JAR</h2> +<p>The POM snippet below shows how to control which project dependencies should be included/excluded in the uber JAR:</p> +<div class="source"><pre class="prettyprint linenums"><project> + ... + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-shade-plugin</artifactId> + <version>3.3.0</version> + <executions> + <execution> + <phase>package</phase> + <goals> + <goal>shade</goal> + </goals> + <configuration> + <artifactSet> + <excludes> + <exclude>classworlds:classworlds</exclude> + <exclude>junit:junit</exclude> + <exclude>jmock:*</exclude> + <exclude>*:xml-apis</exclude> + <exclude>org.apache.maven:lib:tests</exclude> + <exclude>log4j:log4j:jar:</exclude> + </excludes> + </artifactSet> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + ... +</project></pre></div> +<p>Of course, <tt><includes></tt> can be used as well to specify a white list of artifacts. Artifacts are denoted by a composite identifier of the form <i>groupId</i>:<i>artifactId</i>[[:<i>type</i>]:<i>classifier</i>]. Since plugin version 1.3, the wildcard characters '*' and '?' can be used to do glob-like pattern matching.</p> +<p>For fine-grained control of which classes from the selected dependencies are included, artifact filters can be used:</p> +<div class="source"><pre class="prettyprint linenums"><project> + ... + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-shade-plugin</artifactId> + <version>3.3.0</version> + <executions> + <execution> + <phase>package</phase> + <goals> + <goal>shade</goal> + </goals> + <configuration> + <filters> + <filter> + <artifact>junit:junit</artifact> + <includes> + <include>junit/framework/**</include> + <include>org/junit/**</include> + </includes> + <excludes> + <exclude>org/junit/experimental/**</exclude> + <exclude>org/junit/runners/**</exclude> + </excludes> + </filter> + <filter> + <artifact>*:*</artifact> + <excludes> + <exclude>META-INF/*.SF</exclude> + <exclude>META-INF/*.DSA</exclude> + <exclude>META-INF/*.RSA</exclude> + </excludes> + </filter> + </filters> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + ... +</project></pre></div> +<p>Here, Ant-like patterns are used to specify that from the dependency <tt>junit:junit</tt> only certain classes/resources should be included in the uber JAR. The second filter demonstrates the use of wildcards for the artifact identity which was introduced in plugin version 1.3. It excludes all signature related files from every artifact, regardless of its group or artifact id.</p> +<p>Besides user-specified filters, the plugin can also be configured to automatically remove all classes of dependencies that are not used by the project, thereby minimizing the resulting uber JAR:</p> +<div class="source"><pre class="prettyprint linenums"><project> + ... + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-shade-plugin</artifactId> + <version>3.3.0</version> + <executions> + <execution> + <phase>package</phase> + <goals> + <goal>shade</goal> + </goals> + <configuration> + <minimizeJar>true</minimizeJar> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + ... +</project></pre></div> +<p>As of version 1.6, minimizeJar will respect classes that were specifically marked for inclusion in a filter. Note that specifying an include filter for classes in an artifact implicitly excludes all non-specified classes in that artifact. <tt><excludeDefaults>false<\excludeDefaults></tt> will override this behavior so that all non-specified classes still will be included though.</p> +<div class="source"><pre class="prettyprint linenums"><project> + ... + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-shade-plugin</artifactId> + <version>3.3.0</version> + <executions> + <execution> + <phase>package</phase> + <goals> + <goal>shade</goal> + </goals> + <configuration> + <minimizeJar>true</minimizeJar> + <filters> + <filter> + <artifact>log4j:log4j</artifact> + <includes> + <include>**</include> + </includes> + </filter> + <filter> + <artifact>commons-logging:commons-logging</artifact> + <includes> + <include>**</include> + </includes> + </filter> + <filter> + <artifact>foo:bar</artifact> + <excludeDefaults>false</excludeDefaults> + <includes> + <include>foo/Bar.class</include> + </includes> + </filter> + </filters> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + ... +</project></pre></div></div> + </div> + </div> + </div> + <hr/> + <footer> + <div class="container-fluid"> + <div class="row-fluid"> + <p>Copyright ©2002–2022 +<a href="https://www.apache.org/">The Apache Software Foundation</a>. +All rights reserved.</p> + </div> + </div> + </footer> + </body> </html> \ No newline at end of file
