Installing Oracle Jdbc Driver to local Maven Repository

[Last Updated: Sep 11, 2018]


Since Oracle does not provide Oracle JDBC driver in a public maven repository, we have to download it and install to the local Maven repository (.m2 directory).

You can get the driver from here. Download ojdbc7.jar file. Let's say we have saved ojdbc7.jar at following location:

D:\ora-jdbc-driver>dir /b

Now run the following maven command to install the jar to local repository:

 mvn install:install-file -Dfile=ojdbc7.jar
D:\ora-jdbc-driver>mvn install:install-file -Dfile=ojdbc7.jar -DartifactId=ora-jdbc -Dversion=7 -Dpackaging=jar
[INFO] Scanning for projects...
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO] --- maven-install-plugin:2.4:install-file (default-cli) @ standalone-pom ---
[INFO] Installing D:\ora-jdbc-driver\ojdbc7.jar to C:\Users\Joe\.m2\repository\com\oracle\ora-jdbc\7\ora-jdbc-7.jar
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.526 s
[INFO] Finished at: 2018-09-11T13:51:38-05:00
[INFO] ------------------------------------------------------------------------

Now following decadency can be used in pom.xml: