英文:
Maven shade plugin - Jar and dependencies
问题
我正在使用 shade 插件来对 org.apache.poi jar 文件进行阴影处理,因为在 Tomcat 服务器上有一个旧版本。我遇到了一个问题,因为这个 jar 文件引用了其他的 jar 文件(commons-compress、xmlbeans、commons-collections)。我应该如何不仅对这个 jar 文件进行阴影处理,还要对它引用的 jar 文件进行阴影处理?
<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>
<!-- Other relocations for referenced jars can be added here -->
</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>
我尝试过对所有的 jar 文件进行重新定位,但这是不可能的。
英文:
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
得分: 0
我将所有逻辑放在一个外部微服务中,并从Pentaho内部调用。我不知道这是否是最佳解决方案,但我找不到其他解决方案。
英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论