maven-shade-plugin:
官方对此plugin的描述:
shade:shade is bound to the package phase and is used to create a shaded jar.
通俗理解为在package阶段打包出一个需要使用的大包。
使用的时候通常用于:
1,将需要的jar包的依赖也打进来最终的shaded大包中,因为默认的打包不会包含jar包的依赖。
2,进行重命名,特定添加、特定排除等。
结构:
<project>
...
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<!-- put your configurations here -->
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
...
</project>
configurations部分:
filters:
将jar包中的内容排除。它是以groupId:artifactId为标识,在filter内部可以使用/更细致地控制,既可以移除代码文件,也可以移除配置文件。
如:
<filters>
<filter>
<artifact>junit: