Assemble Executable Jar using Maven
This entry in your Maven pom.xml will build a single executable jar file and assemble all your other jar dependencies within it.
[code language=”xml”]
<project>
….
<build>
<plugins>
<!– Plugins for Assembly –>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<configuration>
<finalName>ExecutableJarExample</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>com.skills421.training.ExecutableJarExample</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id> <!– this is used for inheritance merges –>
<phase>package</phase> <!– bind to the packaging phase –>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
[/code]
Tag:executable jar, Maven