<?XML version= "1.0" encoding= "UTF-8"?><Projectxmlns= "http://maven.apache.org/POM/4.0.0"Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"xsi:schemalocation= "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> <groupId>Yourgoupid</groupId> <Artifactid>Yourartifactid</Artifactid> <version>1.0-snapshot</version> <Build> <Plugins> <!--includes the runtime dependencies - <plugin> <groupId>Com.jolira</groupId> <Artifactid>Onejar-maven-plugin</Artifactid> <version>1.4.4</version> <executions> <Execution> <Goals> <goal>One-jar</goal> </Goals> </Execution> </executions> </plugin> <plugin> <groupId>Org.apache.maven.plugins</groupId> <Artifactid>Maven-jar-plugin</Artifactid> <version>2.4</version> <Configuration> <Archive> <Manifest> <Addclasspath>True</Addclasspath> <Classpathprefix>lib/</Classpathprefix> <MainClass>Yourmainclass</MainClass> </Manifest> </Archive> </Configuration> </plugin> </Plugins> </Build> </Project>
In order to make a simple Java program, can be used in the form of Java-jar Yourjar.jar arg1 arg2 Convenient execution, through the One-jar-maven-plugin plug-in can be packaged into a jar, in addition to specify Main-class, You also need to specify Main-class using Maven-jar-plugin.
Reference http://one-jar.sourceforge.net/
One-jar lets a Java application together with its dependency Jars to a single executable JAR file.
How to make a simple MAVEN project support One-jar into a jar Fatjar