0

I am trying to add ojdbc dependency in my pom.xml file to connect with Oracle database.

As shown below, this jar is available in maven repository.

enter image description here

But, after adding it pom.xml file, it's throwing below error. My settings are on auto import, so it should import it automatically.

Error:

com.oracle.ojdbc8.12.2.0.1.0 not found..

I am using Intellij IDEA and java version is 1.8.

Update:

After cleaning and compiling, I got to to know the actual root cause. My repository is set as below :

<repositories>
        <repository>
            <id>confluent</id>
            <url>http://packages.confluent.io/maven/</url>
        </repository>
    </repositories>

So, it's trying to look for ojdbc driver in this repository and not able to find it(my guess). I can't remove the above repository as it is required for other dependency. So, I would like to know how can I force ojdbc dependency to look into maven instead of io.confluent repository. Do I have to set two repositories?

Error :

[ERROR] Failed to execute goal on project PaymentEngine: Could not resolve dependencies for project com.example.test:PaymentEngine:jar:1.0-SNAPSHOT: Failure to find com.oracle:ojdbc8:jar:12.2.0.1.0 in http://packages.confluent.io/maven/ was cached in the local repository, resolution will not be reattempted until the update interval of confluent has elapsed or updates are forced -> [Help 1]

enter image description here

Praveenks
  • 1,436
  • 9
  • 40
  • 79

2 Answers2

1

Try to clean your build and reload maven, got a similar problem today and it worked well for me :)

tstdplt
  • 223
  • 1
  • 8
  • Thanks for quick response. I have updated my question after performing cleanup. Could you please look into it and suggest? – Praveenks Jun 17 '20 at 12:01
  • Oracle JDBC drivers are uploaded on central maven at com.oracle.database.jdbc group id. Check out this blog (https://medium.com/oracledevs/all-in-and-new-groupids-oracle-jdbc-drivers-on-maven-central-a76d545954c6) for more details. – Nirmala Jun 23 '20 at 10:11
0

Please note that mvnrepository has nothing to do with MavenCentral.

When you find an artifact there, it does not mean that Maven will find it in MavenCentral.

Instead, you need to figure out a repository from which you can get the desired jar and then add that repository to your <repositories>.

For the specific jar, this might be difficult, see here (as already suggested by Ben R.):

Find Oracle JDBC driver in Maven repository

J Fabian Meier
  • 33,516
  • 10
  • 64
  • 142