In below steps will show about to add 3rd party/custom/external Jars in local repository for use in our project builds because these jars doesn’t exist in Maven public repository and required to build project.
Pre-Requisite
- Install and Configure Maven in your machine. Follow link for Maven Configuration in Window and Linux
To add these jars we can use below command to load in local repository (.m2/repository)
mvn install:install-file -Dfile= -DgroupId= -DartifactId= -Dversion= -Dpackaging=
Example : Oracle is 3rd party and it’s jars are available in maven public repository. We can use below command to store in maven local repository and make entry in pom.xml to use it.
mvn install:install-file -Dfile=C:\\Workspace\\ojdbc6.jar -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0 -Dpackaging=jar pom.xml entry for above oracle jar com.oracle ojdbc6 11.2.0