简体   繁体   中英

How can I create a non-executable JAR with dependencies using Maven?

I want to package my project in a single non-executable library JAR for distribution. How can I make a Maven project package all dependency JARs into my output JAR? There is a jar-with-dependencies option in Maven assembly plugin to create an executable JAR with dependencies. There is a reciept to obtain the goal. However, I need to build a library jar without Main class. How can I build such a jar?

Its not necessary that you use the maven-jar-plugin to build a non-executable jar. The mvn clean install command by default builds a non-executable jar if it has the node <packaging>jar</packaging> in your projects pom.xml.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM