Home >Java >javaTutorial >How to Resolve Maven Dependencies for the Oracle JDBC Driver?

How to Resolve Maven Dependencies for the Oracle JDBC Driver?

Barbara Streisand
Barbara StreisandOriginal
2024-12-13 05:06:10211browse

How to Resolve Maven Dependencies for the Oracle JDBC Driver?

Resolving Maven Dependency for Oracle JDBC Driver

Incorporating the Oracle JDBC driver into Maven projects for runtime dependency requires locating a compatible repository due to its absence in the Maven Central Repository.

Identifying the Repository

Unfortunately, the binary license for the Oracle JDBC driver precludes its availability in any public repository. Therefore, it becomes imperative for users to refrain from using potentially illegal public repositories containing the driver.

Adding a Local Repository

Despite the lack of a public repository, the Oracle JDBC driver's metadata is accessible in the Maven Central Repository. This metadata provides the necessary information to manually add the driver to the project's local repository.

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

To add the driver, download the JAR file from Oracle's website and use the following Maven command:

mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc14 \
     -Dversion=10.2.0.3.0 -Dpackaging=jar -Dfile=ojdbc.jar -DgeneratePom=true

By enabling POM generation, warnings in the pom.xml file can be avoided. For teams maintaining a local Maven repository, the provided guide aids in uploading the JAR.

The above is the detailed content of How to Resolve Maven Dependencies for the Oracle JDBC Driver?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn