Tuesday, May 13, 2014

Installing the third part jar in local repository in Maven

Hello Guys, these are the simple steps of installing the 3rd party api jar in your local repository and using it in your pom.xml:

Prerequisites:

  1. You should be having the Maven already installed and configured (Link Here)
  2. In order  to check whether your maven is working or not use this command:
    • mvn --version
    • It will return the version of the Maven

After the above you can use this command to install the Jar in your local repository:

mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id>  -DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>

If there's a pom-file as well, you can install it with the following command:

mvn install:install-file -Dfile=<path-to-file> -DpomFile=<path-to-pomfile>

Maven 2.5 if the JAR is built by Maven, it'll contain a pom.xml in a subfolder of the META-INF directory, which will be read by default. In that case, all you need to do is:
mvn install:install-file -Dfile=<path-to-file>