How to Add Oracle JDBC Driver to Maven Project Without Public Repository
In theory, to add the Oracle JDBC driver to your Maven project, you could include the following dependency in your POM:
<dependency> <groupId>com.oracle</groupId> <artifactId>ojdbc14</artifactId> <version>10.2.0.3.0</version> </dependency>
However, this will fail because the driver JAR isn't available in the central Maven repository due to licensing restrictions.
Locating a Repository with Oracle JDBC Driver
Unfortunately, no public repository contains the Oracle JDBC driver, as its binary license prohibits public distribution.
Adding Oracle JDBC Driver Without Repository
Since a public repository isn't available, you'll need to manually download the driver JAR from Oracle's website:
Installing Driver JAR in Local Repository
Once you have the JAR, you can install it in your local Maven repository using the following command:
mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc14 -Dversion=10.2.0.3.0 -Dpackaging=jar -Dfile=ojdbc.jar -DgeneratePom=true
Leveraging Oracle's Maven Info
While there's no public repository, Oracle provides a POM entry in the Maven Central repo with the necessary information:
<groupId>com.oracle</groupId> <artifactId>ojdbc14</artifactId> <version>10.2.0.3.0</version>
This allows you to include the Oracle JDBC driver as a dependency without specifying the repository. Maven will automatically download the JAR from Oracle's website when needed.
The above is the detailed content of How to Add Oracle JDBC Driver to Maven Project Without a Public Repository?. For more information, please follow other related articles on the PHP Chinese website!