Wednesday, July 19, 2017

Adding Oracle to Local Maven Repository and As a Maven Dependency

Oracle is not having a jar file in the global maven repository due to some legal issues. It has to be always downloaded and required to be added as lib for your applications or need to be configure in your app server.

Below is the way to include it in your local maven repository.

1. Download the ojdbc jar file. For example ojdbc7.jar

2. Issue the below command

mvn install:install-file -Dfile={location of downloaded jar}  -DgroupId=com.oracle -DartifactId=ojdbc7 -Dversion={version} -Dpackaging=jar

//example
mvn install:install-file -Dfile=/home/chamara/ojdbc7.jar  -DgroupId=com.oracle -DartifactId=ojdbc7 -Dversion=12.1.0.2.0 -Dpackaging=jar

3. Then add the below dependency

example :
 <dependency>  
      <groupId>com.oracle</groupId>  
      <artifactId>ojdbc7</artifactId>  
      <version>12.1.0.2.0</version>  
 </dependency>