Friday, 9 September 2011

Maven and Oracle's JDBC driver

Due to licensing restrictions, the Oracle JDBC driver jar will not be in the repository. The 
pom is there, and it's useful to add that to the conguration:

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

After that is done, you will then see an error message from mvn about "Could not find artifact com.oracle:ojdbc14:jar:10.2.0.4.0 ...". To resolve that, you need to manually add the JDBC driver jar file to your local .m2 repostiory:

mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc14 \
-Dversion=10.2.0.4.0 -Dpackaging=jar -Dfile=/path/to/ojdbc14.jar


PS: The ojdbc14.jar file will be on your database server in the ${ORACLE_HOME}/jdbc/lib/ directory.

No comments:

Post a Comment