- Step 1 : Create an assembly xml and put it into your resources folder.
- Step 2 : Include assembly.xml in your pom in the plugin-configuration node along with the manifest-mainclass.
- Step 3 : Fire mvn assembly:assembly, it will create simple and uber jar in your target folder.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<assembly> | |
<id>uberjar</id> | |
<formats> | |
<format>jar</format> | |
</formats> | |
<includeBaseDirectory>false</includeBaseDirectory> | |
<dependencySets> | |
<dependencySet> | |
<unpack>false</unpack> | |
<scope>runtime</scope> | |
<useProjectArtifact>false</useProjectArtifact> | |
</dependencySet> | |
</dependencySets> | |
<fileSets> | |
<fileSet> | |
<directory>${project.build.outputDirectory}</directory> | |
<outputDirectory>/</outputDirectory> | |
</fileSet> | |
</fileSets> | |
</assembly> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<build> | |
<pluginManagement> | |
<plugins> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-assembly-plugin</artifactId> | |
<configuration> | |
<descriptors> | |
<descriptor>src/main/resources/assembly.xml</descriptor> | |
</descriptors> | |
<archive> | |
<manifest> | |
<mainClass>com.bala.MyMainClass</mainClass> | |
<addClasspath>true</addClasspath> | |
</manifest> | |
</archive> | |
</configuration> | |
</plugin> | |
</plugins> | |
</pluginManagement> | |
</build> |
No comments:
Post a Comment