[Apache Maven Shade Plugin] [example] [001] 官方例子:includes-excludes
链接地址:[Selecting Contents for Uber JAR](http://maven.apache.org/plugins/maven-shade-plugin/examples/includes-excludes.html)
apache网站在国内打开太慢了。因此我将这些有用的资源收集起来,保存在博客中!
Apache Maven Shade Plugin:是一个Maven打包的插件。其官网英文定义如下:This plugin provides the capability to package the artifact in an uber-jar, including its dependencies and to shade
001.
1 <project> 2 ... 3 <build> 4 <plugins> 5 <plugin> 6 <groupId>org.apache.maven.plugins</groupId> 7 <artifactId>maven-shade-plugin</artifactId> 8 <version>2.4.3</version> 9 <executions> 10 <execution> 11 <phase>package</phase> 12 <goals> 13 <goal>shade</goal> 14 </goals> 15 <configuration> 16 <artifactSet> 17 <excludes> 18 <exclude>classworlds:classworlds</exclude> 19 <exclude>junit:junit</exclude> 20 <exclude>jmock:*</exclude> 21 <exclude>*:xml-apis</exclude> 22 <exclude>org.apache.maven:lib:tests</exclude> 23 <exclude>log4j:log4j:jar:</exclude> 24 </excludes> 25 </artifactSet> 26 </configuration> 27 </execution> 28 </executions> 29 </plugin> 30 </plugins> 31 </build> 32 ... 33 </project>
002.
1 <project> 2 ... 3 <build> 4 <plugins> 5 <plugin> 6 <groupId>org.apache.maven.plugins</groupId> 7 <artifactId>maven-shade-plugin</artifactId> 8 <version>2.4.3</version> 9 <executions> 10 <execution> 11 <phase>package</phase> 12 <goals> 13 <goal>shade</goal> 14 </goals> 15 <configuration> 16 <filters> 17 <filter> 18 <artifact>junit:junit</artifact> 19 <includes> 20 <include>junit/framework/**</include> 21 <include>org/junit/**</include> 22 </includes> 23 <excludes> 24 <exclude>org/junit/experimental/**</exclude> 25 <exclude>org/junit/runners/**</exclude> 26 </excludes> 27 </filter> 28 <filter> 29 <artifact>*:*</artifact> 30 <excludes> 31 <exclude>META-INF/*.SF</exclude> 32 <exclude>META-INF/*.DSA</exclude> 33 <exclude>META-INF/*.RSA</exclude> 34 </excludes> 35 </filter> 36 </filters> 37 </configuration> 38 </execution> 39 </executions> 40 </plugin> 41 </plugins> 42 </build> 43 ... 44 </project>