Maven Shade插件配置未替换软件包

时间:2020-02-25 16:28:43

标签: maven maven-shade-plugin

根据Maven dependency incompatible library class的要求,我尝试了如下所示的阴影插件,但徒劳无功。

fromAsset()

我的目标是用类x.y.z替换a.b.c结构的包。 我在这里错过任何重要配置吗?

1 个答案:

答案 0 :(得分:1)

要在着色罐中用 xyz 替换软件包 abc ,您应在maven-shade-plugin上添加 relocations 条目,如下所示:

<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>
相关问题