Jarsplice - 将apache库与我的jar结合起来
问题描述:
我用apache等第三方库创建了一个程序,我试图将它们全部放入可运行的.jar文件中。我搜索了很多,我发现了一个名为“JarSplice - The Fat Jar Creator”程序,但是当我去创建最终的罐子,我发现了错误:Jarsplice - 将apache库与我的jar结合起来
Jar creation failed due to the following exception:
duplicate entry: org/apache/xmlbeans/xml/stream/Location.class
我的第三方库有:
poi-3.14-20160307.jar
poi-examples-3.14-20160307.jar
poi-excelant-3.14-20160307.jar
poi-ooxml-3.14-20160307.jar
poi-ooxml-schemas-3.14-20160307.jar
poi-scratchpad-3.14-20160307.jar
xmlbeans-2.6.0.jar
我没有看到任何重复:/所以我做错了什么?有什么办法可以使这个错误无效吗?任何帮助将不胜感激!
我强烈建议使用[Maven](https://maven.apache.org/index.html)创建一个具有依赖关系的JAR。如果你真的想要一个包含所有类文件的JAR,你可以使用Maven [shade plugin](https://maven.apache.org/plugins/maven-shade-plugin/)。 – Adam
感谢您的回答@adamr。我这样做[链接](https://dzone.com/articles/how-build-fat-jar-using) – John
很酷,很高兴你得到它的工作。我认为你应该发布你的解决方案作为答案并接受它,它可能会在未来帮助某人。 – Adam