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?
Since September 2019, the Oracle JDBC Driver is available on Maven Central. For Java 11 and newer version, use the following Maven dependency: For Java 8, use the ojdbc8 artifact instead: For Java 6, use the ojdbc6 artifact instead:
The MySQL Driver is available on Maven Central, so just add the following dependency to your pom.xml file: Use this Maven Central link to get the latest artifact version for the MySQL JDBC Driver.
Use the following Maven dependency to get the Apache Derby JDBC Driver from Maven Central: To get the latest version of the Derby JDBC Driver, use this Maven Central query link. That’s it! If you enjoyed this article, I bet you are going to love my Book and Video Courses as well.
The H2 database JDBC Driver is available on Maven Central, so you can use the following Maven dependency: This Maven Central link will tell you which is the latest version of the H2 JDBC artifact. Use the following Maven dependency to get the Apache Derby JDBC Driver from Maven Central:
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With