How to add JAR file to local Maven repository?

How to add JAR file to local Maven repository?

How to add JAR file to local Maven repository? This task will be presented on Oracle JDBC driver, because due to licencing reasons this JAR file is not in Maven central repository, but it's widely used in Maven projects.

 

First you must have installed Maven, which was presented in my previous video tutorial.

 

Next open command line and issue this command:

mvn install:install-file -Dfile=ojdbc6.jar -DgroupId=com.oracle -DartifactId=ojdbc6
-Dversion=11.2.0 -Dpackaging=jar

 

Afterwards you can reference it in pom.xml using this dependency:

<!-- Oracle database driver -->
<dependency>
  <groupId>com.oracle</groupId>
  <artifactId>ojdbc6</artifactId>
  <version>11.2.0</version>
</dependency>