0

Maven – Create an executable jar

This post demonstrates how to create an executable jar in Apache Maven using maven-shade-plugin plugin.

Software Requirements

  1. Java 8
  2. Eclipse Mars.2
  3. Maven 3.3.3 (Embedded)

Update pom.xml

Create a Maven project in Eclipse or open an existing Maven project, update your pom.xml with the following plugin.

Package it

To package it from Eclipse, run embedded Maven using the package goal.

Test Out

Depending on your current configuration, your JAVA_HOME and PATH may no be properly set. In this case, simply set them up on the same Windows command line window.

There will be two (2) jar files generated. Choose the one without the original- prefix on the file name.

Download the Codes

https://github.com/Turreta/Maven-Create-executable-jar

Karl San Gabriel

Karl San Gabriel

Java and Enterprise Technologies Expert