How to add Oracle JDBC driver in your Maven local repository

Oracle does not provide library to maven. So we need to download the jar and add path to the project.

Below is the process for installing ojdbc14.jar to maven

Step1: Download ojdbc14.jar from oracle website

Step2: Save it to a folder and in command prompt navigate to respective folder
E.g: C:\Users\Anand\Desktop

Step3: Run the below command

mvn install:install-file -DgroupId=com.oracle -Dartif
actId=ojdbc14 -Dversion=10.2.0.1.0 -Dpackaging=jar -Dfile=ojdbc14.jar -Dgenerate
Pom=true



Yow will get below messages on successful installation

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.4:install-file (default-cli) @ standalone-pom
---
[INFO] Installing C:\Users\AnandBaba\Desktop\ojdbc14.jar to C:\Users\AnandBaba\.
m2\repository\com\oracle\ojdbc14\10.2.0.1.0\ojdbc14-10.2.0.1.0.jar
[INFO] Installing C:\Users\ANANDB~1\AppData\Local\Temp\mvninstall910411268917029
3395.pom to C:\Users\AnandBaba\.m2\repository\com\oracle\ojdbc14\10.2.0.1.0\ojdb
c14-10.2.0.1.0.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.432 s
[INFO] Finished at: 2016-07-17T12:08:50+05:30
[INFO] Final Memory: 6M/123M
[INFO] ------------------------------------------------------------------------
C:\Users\Anand\Desktop> 


Step3:
Add below dependency in pom.xml

 <dependency>
 <groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>10.2.0.1.0</version>
</dependency>    

 


No comments:

Post a Comment