Creating JAR containing all classes of web application

Standard

Encapsulating all the web app’s source files into a singular JAR by modifying the pom.xml

Add the following information into the plugins section.

<plugin>
   <artifactId>maven-war-plugin</artifactId>
   <version>2.5</version>
   <configuration>
      <archiveClasses>true</archiveClasses>
   </configuration>
</plugin>

Cleaned and build the project to generate a snapshot of all class files. The log files will display the location of the jar that has been built.

Building jar: /PATH/TO/PROJECT/target/PROJECTNAME-1.0-SNAPSHOT/WEB-INF/lib/PROJECTNAME-1.0-SNAPSHOT.jar