snippetjavaCritical
How can I create an executable/runnable JAR with dependencies using Maven?
Viewed 0 times
mavenwithhowcreateusingdependenciesexecutablecanjarrunnable
Problem
I want to package my project in a single executable JAR for distribution.
How can I make a Maven project package all dependency JARs into my output JAR?
How can I make a Maven project package all dependency JARs into my output JAR?
Solution
maven-assembly-plugin
fully.qualified.MainClass
jar-with-dependencies
and you run it with
mvn clean compile assembly:single
Compile goal should be added before assembly:single or otherwise the code on your own project is not included.
See more details in comments.
Commonly this goal is tied to a build phase to execute automatically. This ensures the JAR is built when executing
mvn install or performing a deployment/release.
maven-assembly-plugin
fully.qualified.MainClass
jar-with-dependencies
make-assembly
package
single
Context
Stack Overflow Q#574594, score: 2852
Revisions (0)
No revisions yet.