Maven Shade插件-Jar和依赖项

问题描述

我正在使用shade插件为org.apache.poi jar着色,因为Tomcat服务器上有一个旧版本。我有一个问题,因为此jar引用了其他jar(commons-compress,xmlbeans,commons-collections)。我该如何不仅遮盖这个罐子,而且遮盖它的引用罐子?

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-shade-plugin</artifactId>
    <version>3.2.4</version>
    <executions>
        <execution>
            <phase>package</phase>
            <goals>
                <goal>shade</goal>
            </goals>
            <configuration>
                <shadedClassifierName>shaded</shadedClassifierName>
                <shadedArtifactAttached>true</shadedArtifactAttached>
                <relocations>
                    <relocation>
                        <pattern>org.apache.poi</pattern>
                        <shadedPattern>hidden.org.apache</shadedPattern>
                    </relocation>
                </relocations>
                <filters>
                    <filter>
                        <artifact>*:*</artifact>
                        <excludes>
                            <exclude>meta-inf/maven/**/*</exclude>
                            <exclude>meta-inf/*.SF</exclude>
                            <exclude>meta-inf/*.DSA</exclude>
                            <exclude>meta-inf/*.RSA</exclude>
                        </excludes>
                    </filter>
                </filters>
            </configuration>
        </execution>
    </executions>
</plugin>

我试图重新放置所有的罐子,但这是不可能的。

解决方法

我将所有逻辑放在一个外部微服务上,并从 Pentaho 内部调用。我不知道这是否是最好的解决方案,但我找不到另一个。