Skip to content

Instantly share code, notes, and snippets.

@ByoungInKim
Created May 12, 2017 09:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ByoungInKim/91ac6c0561d38bd27f118aab6ce17945 to your computer and use it in GitHub Desktop.
Save ByoungInKim/91ac6c0561d38bd27f118aab6ce17945 to your computer and use it in GitHub Desktop.
How to Create Executable JAR file with resources and dependencies using Maven
<project ....>
<modelVersion>4.0.0</modelVersion>
<groupId>com.inventory</groupId>
<artifactId>Inventory</artifactId>
<packaging>jar</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>Inventory Management</name>
<dependencies>
....
</dependencies>
<build>
<plugins>
<!--- Add below code -->
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>com.inventory.gui.InventoryApp</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
<!--- end code -->
</plugins>
</build>
</project>
@ByoungInKim
Copy link
Author

After then you will run maven command
mvn clean install assembly:single

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment