Question

I have created a Maven Project in Eclipse (EE Developer Kepler version) and I have in my pom.xml file the following error, "Missing artifact com.oracle:ojdbc7:jar:12.1.0.1" in this code

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

I know that I have to add the jdbc repository into my .m2 folder. I have done so by downloading the ojdbc7.jar from the following link http://www.oracle.com/technetwork/database/features/jdbc/jdbc-drivers-12c-download-1958347.html

With that archive donwloaded, I open a terminal (I have Debian installed) and run the following command as root

mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc7  
-Dversion=12.1.0.1 -Dpackaging=jar -Dfile=ojdbc7.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

What can I do to fix this?

Was it helpful?

Solution

If you are using eclipse, go to the folder where you have your pom and try this commands:

mvn -Declipse.workspace=<path-to-your-eclipse-workspace> eclipse:add-maven-repo
mvn eclipse:eclipse

I haven't tried it in Linux, but it should fix your dependencies / eclipse path issues.

OTHER TIPS

  1. From the menu, select "Window-->Show View-->Other..."
  2. In the dialog, select "Maven-->Maven Repositories" and hit OK.
  3. In the Maven Repositories view, right-click "Local Repositories-->Local Repository" and select "Rebuild Index" from the popup menu. If asked if you're sure you want to rebuild the index, hit OK.

If that doesn't work (it should), try right-clicking the project in the Explorer view, selecting "Maven-->Update Project..." from the popup menu, ensuring that "Update dependencies" is checked in the dialog that appears, and hitting OK.

BTW, you probably want to add <scope>runtime</scope> to your dependency element in the pom file, although that's not related to your issue.

There is another choice for the Oracle JDBC drivers, that is not perfect, because it requires to be registered in the maven repository from Oracle, but it does not need the mvn install:install-file step.

Check the steps to set it up here:

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top