15

I have imported a Maven Project in Eclipse (EE Developer) and I have in my pom.xml file the following error, “Missing artifact com.oracle:ojdbc7:jar:12.1.0.2″ in this code:

<dependency>
    <groupId>com.oracle</groupId>
    <artifactId>ojdbc7</artifactId>
    <version>12.1.0.2</version>
</dependency>

I have done so by downloading the ojdbc7.jar and run this command:

mvn install:install-file -Dfile=/Path-to-jar/ojdbc7.jar
-DgroupId=com.oracle 
-DartifactId=ojdbc7 
-Dversion=12.1.0.2 
-Dpackaging=jar 
-DgeneratePom=true

After that, I got as an output BUILD SUCCESS, and if I go to the .m2 folder I see in the com->oracle->ojdbc7 two files called “ojdbc7-12.1.0.1.jar.lastUpdated” and “ojdbc7-12.1.0.1.pom.lastUpdated” but still Eclipse brings me the code into the pom.xml file as an error?!?!?! Can some one help?

Masih
  • 1,633
  • 4
  • 19
  • 38
  • Appears that jar just plain "might not be available" in public maven repo's. Weird. https://stackoverflow.com/questions/1074869/find-oracle-jdbc-driver-in-maven-repository/1074971#1074971 – rogerdpack Feb 04 '20 at 21:20

5 Answers5

11

This artifact version (12.1.0.2) has been removed to an another dependency.

See: https://mvnrepository.com/artifact/com.oracle/ojdbc7

Try to change the new dependency:

<dependency>
    <groupId>com.oracle.database.jdbc</groupId>
    <artifactId>ojdbc8</artifactId>
    <version>12.2.0.1</version>
</dependency>
Matt Ke
  • 3,599
  • 12
  • 30
  • 49
Ramcics
  • 111
  • 1
  • 3
4

After successfully running the "mvn install" command right click your Project -> Maven -> Update Project (or Alt+F5).

Moritz
  • 85
  • 9
0

I would get rid of those 2 files manually (lastUpdated) then re-run your install command and finally build your project. Those 2 files have been created by mvn as flags to avoid refetching them for a certain amount of time. They certainly have been created prior to your manual install-file command.

Franck
  • 1,754
  • 1
  • 13
  • 14
0

I recommend you to follow the instruction given in this link. "http://javabycode.com/build-tools/maven/add-oracle-jdbc-driver-maven.html"

As per your dependency in pom.xml there should be 4 files generated inside "m2repo\com\oracle\ojdbc7\12.1.0.2" folder.

  1. ojdbc7-12.1.0.2.jar
  2. ojdbc7-12.1.0.2.jar.lastUpdated
  3. ojdbc7-12.1.0.2.pom
  4. ojdbc7-12.1.0.2.pom.lastUpdated

But as you are saying you checked for "ojdbc7-12.1.0.1.jar.lastUpdated", that should not be the case. I recommend you to delete your dependency folder and then start from scratch.

Vicky
  • 1,135
  • 1
  • 17
  • 37
0

Some how the jar is not getting downloaded into the local pc. I opened the maven site https://mvnrepository.com/artifact/com.oracle/ojdbc7/12.1.0.2 and downloaded the required jar and placed it in to the .m2 folder, and the error is gone.

Suresh
  • 1,491
  • 2
  • 22
  • 27