Maven: Steps to installing Commercial/3rd Party/Own JARs

Maven: Steps to installing Commercial/3rd Party/Own JARs
Sometimes you will have Commercial/3rd party/Own JARs that you need to put or install in your local repository for using in your builds or application, since they don't having any public repository like Maven Repo/Repository. In that situation we need to maintain the JAR in our local Repo. For installing the JAR in our local repo, Apache Maven given a goal/command in the maven-install-plugin which make available JAR in our local repository, by default maven was create a local repository in C:\Users\<your computer user name>\.m2\repository,  to generate a JAR in your local repository follow/use the below command.

Syntax:
mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> -DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>
For example I am taking ojdbc14 as a 3rd party jar, and my maven dependency is like below
            <dependency>
                  <groupId>oracle.jdbc.driver</groupId>
                  <artifactId>ojdbc14</artifactId>
                  <version>10.2.0</version>
            </dependency>
And ojdbc14.jar is available in the location C:\Users\gurugubelli\Desktop\gurugubelli, Then frame a command like below
mvn install:install-file -Dfile=C:\Users\gurugubelli\Desktop\gurugubelli\ojdbc14.jar -DgroupId=oracle.jdbc.driver -DartifactId=ojdbc14 -Dversion=10.2.0 -Dpackaging=jar


After executing this command ojdbc14.jar file has available in Local Repository(our computer). For cross verifying check the location c:\Users\<your computer user name>\.m2\repository\oracle\jdbc\driver\ojdbc14\10.2.0\, here we can find below structure.



It means 3rd Party/Own jar is installed successfully on you computer. So you can use these jar using below maven dependency.
<dependency>
      <groupId>oracle.jdbc.driver</groupId>
       <artifactId>ojdbc14</artifactId>
       <version>10.2.0</version>
</dependency> 


Maven: Steps to installing Commercial/3rd Party/Own JARs Maven: Steps to installing Commercial/3rd Party/Own JARs Reviewed by Gurugubelli Technologies on January 04, 2017 Rating: 5

No comments:

Powered by Blogger.