Monday, 30 March 2015

Maven : Creating jar with dependencies

While working with the maven, it is a case that all the dependent jars will not be packed into the jar, whereas in case of war, all the dependent jars wil be packed into web/lib folder. If you want to create a simple jar with all its dependency jars then you need to create uber jar.(Uber means Super, extreme or outstanding). Here are the steps to create uber jar using maven.

  • 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.