Generate All-in-one JAR file using Maven in Eclipse

add this paragraph of code to your pom.xml file in parallel to dependencies tag.. Customize the “mainClass” to your class path. Then run project as Maven Build…, type “clean package assembly:single” into the goal box and run the build. And you will have a JAR file with all the dependencies included in the target directory in your project folder.

<build>

<plugins>

<plugin>

<artifactId>maven-assembly-plugin</artifactId>

<configuration>

<archive>

<manifest>

<mainClass>arrow.CoreParser</mainClass>

</manifest>

</archive>

<descriptorRefs>

<descriptorRef>jar-with-dependencies</descriptorRef>

</descriptorRefs>

</configuration>

</plugin>

</plugins>

</build>

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s