Maven shade plugin - Jar and dependencies

Viewed 189

I'm using shade plugin to shade org.apache.poi jar because there is an old version on Tomcat server. I have a problem because this jar makes reference to others jars (commons-compress, xmlbeans, commons-collections). How can I shade not only this jar but also its references jars?

<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>

I tried to relocate all the jars but it's impossible.

1 Answers

I put all the logic on an external microservice and called from inside Pentaho. I don't know if it is the best solution but I couldn't find another one.

Related