2016-08-19 15 views
0

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

我沒有看到任何重複:/所以我做錯了什麼?有什麼辦法可以使這個錯誤無效嗎?任何幫助將不勝感激!

+0

我強烈建議使用[Maven](https://maven.apache.org/index.html)創建一個具有依賴關係的JAR。如果你真的想要一個包含所有類文件的JAR,你可以使用Maven [shade plugin](https://maven.apache.org/plugins/maven-shade-plugin/)。 – Adam

+0

感謝您的回答@adamr。我這樣做[鏈接](https://dzone.com/articles/how-build-fat-jar-using) – John

+0

很酷,很高興你得到它的工作。我認爲你應該發佈你的解決方案作爲答案並接受它,它可能會在未來幫助某人。 – Adam

回答

相關問題