Maven shade插件配置不替换软件包
基于在的需求,我尝试了如下的shade插件,但没有成功Maven shade插件配置不替换软件包,maven,maven-shade-plugin,Maven,Maven Shade Plugin,基于在的需求,我尝试了如下的shade插件,但没有成功 <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <executions> <execution> <phase>compile</phase> <goals>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<filters>
<filter>
<artifact>com.lib:Encoder</artifact>
<includes>
<include>x/y/z/**</include>
</includes>
<excludes>
<exclude>a/b/c/**</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
org.apache.maven.plugins
maven阴影插件
编译
阴凉处
com.lib:编码器
x/y/z/**
a/b/c/**
我的目标是用类的x.y.z替换a.b.c结构的包。
我错过了这里的任何关键配置吗?要在着色jar上用x.y.z替换包a.b.c,您应该在maven shade插件上添加重定位条目,如下所示:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<minimizeJar>true</minimizeJar>
<relocations>
<relocation>
<pattern>x.y.z</pattern>
<shadedPattern>a.b.c</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>
org.apache.maven.plugins
maven阴影插件
3.1.0
包裹
阴凉处
真的
整数解
a、 不列颠哥伦比亚省
检查仍面临相同故障的文档。此外,我还尝试了“安装”的方法。还不走运!你面临什么样的失败?您可以共享详细信息吗?/无法访问a.b.c.Template的a.b.c.Template[错误]类文件。找不到模板它用于-mvn安装