How to add 3rd Party/Custom/External Jars to Maven Project?

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.


To add these jars we can use below command to load in local repository (.m2/repository)

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

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 -DartifactId=ojdbc6 -Dversion=11.2.0 -Dpackaging=jar

pom.xml entry for above oracle jar



This site uses Akismet to reduce spam. Learn how your comment data is processed.