Monday, February 18, 2013

Install jar to local repo which are not available in maven repository

If you find a jar which is not in any maven repository. But you need it to build you maven project you can first install that jar to you local repo using mvn install:install-file .

e.g: java-gmail-imap.1.4.4-gm-ext-0.6.jar is not in any maven repository therefore i need to install it on my local repository, run following command in terminal

mvn install:install-file -Dfile=/path/to/java-gmail-imap.1.4.4-gm-ext-0.6.jar -DgroupId=com.google.code -DartifactId=java-gmail-imap -Dversion=1.4.4-gm-ext-0.6 -Dpackaging=jar

you will see

[INFO] --- maven-install-plugin:2.3.1:install-file (default-cli) @ org.example --- [INFO] Installing /path/to/java-gmail-imap-1.4.4-gm-ext-0.5.jar to /home/user/.m2/repository/com/google/code/java-gmail-imap/1.4.4-gm-ext-0.6/java-gmail-imap-1.4.4-gm-ext-0.6.jar [INFO] Installing /tmp/mvninstall4760815746928565678.pom to /home/user/.m2/repository/com/google/code/java-gmail-imap/1.4.4-gm-ext-0.6/java-gmail-imap-1.4.4-gm-ext-0.6.pom [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------

Now my java-gmail-imap.1.4.4-gm-ext-0.6.jar is in my local repo, and will add this as a dependency to my project

<dependency>
<groupId>com.google.code</groupId> <artifactId>java-gmail-imap</artifactId> <version>1.4.4-gm-ext-0.6</version>
</dependency>


that's all now you can build your project :)


Sample Text

Website counter

Categories