Social Icons

twitterfacebookgoogle pluslinkedinrss feed

Wednesday, April 04, 2012

Maven add jar without install

I have some problem with adding external jar in to maven project without install it. If I install JAR file other people who working on same project, have to install same JAR. them I want to avoid that issue.

First need to place jar file inside lib folder. After that using following POM entry we can use it as dependency.

<dependency>
   <groupId>com.chandana</groupId>
   <artifactId>example</artifactId>
   <version>0.1</version>
   <scope>system</scope>
   <systemPath>${basedir}/lib/example.0.1.jar</systemPath>
</dependency>


Ex:
<dependency>
   <groupId>com.sun</groupId>
   <artifactId>tools</artifactId>
   <version>1.5.0</version>
   <scope>system</scope>
   <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
</dependency>

 Here very important option is <scope>system</scope>. It's say dependency provide with system, no need to look at repository. More about System Dependency