Add maven-assembly-plugin for "fat jar" creation

The project to be analyzed needs to be configured to produce a jar with dependencies (a so-called "fat jar"). Modify thepom.xmlto include maven-assembly-plugin which will ensure that the dependencies of the project are included in the jar file.

Add the following to thepom.xmlfile, in the <build><plugins> section (see also Appendix 2):

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-assembly-plugin</artifactId>
  <version>2.4.1</version>
  <configuration>
    <descriptorRefs>
      <descriptorRef>jar-with-dependencies</descriptorRef>
    </descriptorRefs>
  </configuration>
  <executions>
    <execution>
    <id>make-assembly</id>
    <phase>package</phase>
    <goals>
      <goal>single</goal>
    </goals>
    </execution>
  </executions>
</plugin>

Build the project and check the target folder under Project to see the new jar file which has been created -java-demo-1.0.1-jar-with-dependencies.jar.

results matching ""

    No results matching ""