Skip to content

Instantly share code, notes, and snippets.

@yangl
Last active July 27, 2022 08:38
Show Gist options
  • Save yangl/830e7338faf460bc5acc0442c6f6c132 to your computer and use it in GitHub Desktop.
Save yangl/830e7338faf460bc5acc0442c6f6c132 to your computer and use it in GitHub Desktop.
maven-shade-plugin把强依赖的jar包更改包名并一起打包到自己的jar中,防止依赖冲突,中件间团队必会淫技!http://maven.apache.org/plugins/maven-shade-plugin/index.html
<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>
<createDependencyReducedPom>true</createDependencyReducedPom>
<promoteTransitiveDependencies>true</promoteTransitiveDependencies>
<artifactSet>
<includes>
<include>io.netty:*</include>
</includes>
</artifactSet>
<relocations>
<relocation>
<pattern>io.netty</pattern>
<shadedPattern>io.lettuce.core.io.netty</shadedPattern>
</relocation>
</relocations>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
<transformer
implementation="org.apache.maven.plugins.shade.resource.PluginXmlResourceTransformer"/>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
<profile>
<id>linux-x86_64</id>
<activation>
<os>
<name>linux</name>
<arch>x86_64</arch>
</os>
</activation>
<properties>
<os.detected.classifier>linux-x86_64</os.detected.classifier>
</properties>
</profile>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment