How to add Oracle JDBC driver in your Maven local repository
Unfortunately due the binary license there is no public repository with the Oracle Driver JAR. This happens
with many dependencies but is not Maven's fault. If you happen to find a public repository containing the JAR you can be
sure that is illegal.
This example gives step by step introductions to add Oracle JDBC driver into your Maven local repository
and also how to reference it into your pom.xml file.
First download ojdbc jar file from Oracle JDBC Driver Website
Then run below maven command: (change values according to downloaded file name & version)
mvn install:install-file -Dfile=<your-jar-file-location> -DgroupId=com.oracle
-DartifactId=ojdbc6 -Dversion=<your-jar version> -Dpackaging=jar
|
Now add a dependency in your pom.xml as shown below, which references the jar from your local maven repository.
<!-- ojdbc7.jar example -->
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0</version>
</dependency>
|
This example is valid not only for Oracle driver, it is valid for any jar file which is not available in
maven public repository.
|