Add Oracle JDBC Jar to Maven Repository

If a jar is not available from a public repository (for example, Oracle JDBC jars), then you can get Maven to manually install a copy of the jar in the local repository. To manually deploy the Oracle JDBC driver to your local repository type the following:

mvn install:install-file -Dfile={ORACLE_HOME}/jdbc/lib/ojdbc6.jar -Dpackaging=jar\
 -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.1.0

where {ORACLE_HOME} is the path to the Oracle Database installation.

You can then reference the the jar via a dependency declaration like the following:

<dependency>
 <groupId>com.oracle</groupId>
 <artifactId>ojdbc6</artifactId>
 <version>11.1.0</version>
</dependency>
Advertisements