You are here:Home » Tools » Build an executable jar using Maven

Build an executable jar using Maven

1) Create an executable jar with dependencies using Maven
-> add the following code into your pom.xml file

-> Note to replace "" with your main class name

-> then run $ mvn clean compile assembly:single
The newly created "*-jar-with-dependencies.jar"(suppose it is "A-jar-with-dependencies.jar") file is under the directory called target
-> $ zip -d target/A-jar-with-dependencies.jar META-INF/LICENSE
-> $ hadoop jar target/A-jar-with-dependencies.jar MainClass InputPath OutputPath

2) Create an executable Jar with Eclipse
-> File -> Export.. -> Runnable JAR file
set the Export destination
and choose "Extract required libraries into generated JAR"


Post a Comment