LATEST POSTS





4/05/2016

Maven plugin to create jar file with dependencies





We know maven is good build tool to create war/jar files. We might be having scenario of using third party jars in our project which is not published in maven repository. This jar files generally kept in our class path.When we create a jar file for our project we need to package with third party jars sine our project dependent on third party jars. Maven has provided the plugin to achieve this requirement and this plugin needs to be added in build configuration of pom.xml as like  below.

<build>
  <finalName>Utility</finalName>
  <plugins>
    <plugin>
    <artifactId>maven-assembly-plugin</artifactId>
    <executions>
     <execution>
      <phase>install</phase>
      <goals>
       <goal>single</goal>
      </goals>
     </execution>
    </executions>
    <configuration>
     <descriptorRefs>
      <descriptorRef>jar-with-dependencies</descriptorRef>
     </descriptorRefs>
     <appendAssemblyId>false</appendAssemblyId>
    </configuration>
   </plugin>
  </plugins>
 </build>

0 comments:

Post a Comment

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | coupon codes