Reputation: 39
<dependency>
<groupId>oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.3</version>
</dependency>
This dependency not be downloaded. What am I doing?
Upvotes: 0
Views: 71
Reputation: 1338
Yes, Oracle JDBC drivers will be available on central maven. 19.3 version is currently available and other versions will follow soon. Refer to this blog for more details. Also, check out the Maven repo to browse the available jars.
Upvotes: 0
Reputation: 681
This has already been covered on another question, but there's new information.
Starting in 2016, Oracle started posting its drivers to a secure Oracle Maven repository, and they post the instructions for how to use the repository on their site. The process looks like this:
mvn -emp [YOUR MASTER PASSWORD]
<servers>
<server>
<id>maven.oracle.com </id>
<username>YOUR ORACLE USERNAME</username>
<password>YOUR ORACLE PASSWORD</password>
<configuration>
<basicAuthScope>
<host>ANY </host>
<port>ANY </port>
<realm>OAM 11g </realm>
</basicAuthScope>
<httpConfiguration>
<all>
<params>
<property>
<name>http.protocol.allow-circular-redirects </name>
<value>%b,true </value>
</property>
</params>
</all>
</httpConfiguration>
</configuration>
</server>
</servers>
mvn -ep [YOUR ORACLE PASSWORD]
<repositories>
<repository>
<id>maven.oracle.com</id>
<name>oracle-maven-repo</name>
<url>https://maven.oracle.com</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>maven.oracle.com</id>
<name>oracle-maven-repo</name>
<url>https://maven.oracle.com</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</releases>
</pluginRepository>
</pluginRepositories>
After you do this, Maven will be able to resolve the dependencies.
As of September 2019, Oracle has started posting its jars to Maven Central. If you can use those versions, then you can just update your dependency:
<dependency>
<groupId>com.oracle.ojdbc</groupId>
<artifactId>ojdbc8</artifactId>
<version>19.3.0.0</version>
</dependency>
Upvotes: 2
Reputation: 3230
Oracle drivers can't be installed using maven, as stated by the author of this blog post:
Due to Oracle license restrictions, the Oracle JDBC driver is not available in the public Maven repository. To use the Oracle JDBC driver with Maven, you have to download and install it into your Maven local repository manually.
You have to download the correct drivers manually and then you can take one of two possible paths, namely:
Here a some examples of both cases:
mvn install:install-file -Dfile=path/to/your/ojdbc6.jar -DgroupId=com.oracle
-DartifactId=ojdbc6 -Dversion=11.2.0.3 -Dpackaging=jar
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.3</version>
</dependency>
This is quite simple and straight to the point, just put the jar file in some folder and indicate the path in your dependency, you can even use any project path but you will have to be careful with possible legal issues about the driver license or distribution rules; so I recommend you using the first option.
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>6</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/ojdbc6.jar</systemPath>
</dependency>
As this process needs to be repeated in every development machine, is worth to mention that you should leave some form of documentation indicating the need of this driver and the necessary steps to install it.
Regards
Upvotes: 0