Oracle JDBC ojdbc6 Jar as a Maven Dependency Oracle JDBC ojdbc6 Jar as a Maven Dependency oracle oracle

Oracle JDBC ojdbc6 Jar as a Maven Dependency


It is better to add new Maven repository (preferably using your own artifactory) to your project instead of installing it to your local repository.

Maven syntax:

<dependency>    <groupId>com.oracle</groupId>    <artifactId>ojdbc6</artifactId>    <version>11.2.0.3</version></dependency>... <repositories>    <repository>      <id>codelds</id>      <url>https://code.lds.org/nexus/content/groups/main-repo</url>    </repository>  </repositories>

Grails example:

mavenRepo "https://code.lds.org/nexus/content/groups/main-repo"build 'com.oracle:ojdbc6:11.2.0.3'


For anyone reading this post in the future, you don't need to cd to the directory where the jar is present. Here is what you need to do -

Go to your project folder from where you can run maven commands (When you do an ls -ltr in this folder, you should see pom.xml)

Do this -

mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0.3 -Dpackaging=jar -Dfile=<Path where the jar is, example downloads>/ojdbc6.jar -DgeneratePom=true

Once this is done, you can add the dependency in your pom.xml, something like this -

    <dependency>        <groupId>com.oracle</groupId>        <artifactId>ojdbc6</artifactId>        <version>11.2.0.3</version>    </dependency>


The correct answer was supplied by Raghuram in the comments section to my original question.

For whatever reason, pointing "mvn install" to a full path of the physical ojdbc6.jar file didn't work for me. (Or I consistently repeatedly flubbed it up when running the command, but no errors were issued.)

cd-ing into the directory where I keep ojdb6.jar and running the command from there worked the first time.

If Raghuram would like to answer this question, I'll accept his answer instead. Thanks everyone!