Dealing with “Could not find artifact com.oracle:ojdbc6:jar”

This specific content was written 9 years ago. Please keep this in mind as it may be outdated and not adhering to best-practices.

Introduction

Chris Georgoulis and I describe solutions to working around the following maven error:

Could not find artifact com.oracle:ojdbc6:jar:11.2.0.4.0 in central (https://repo.maven.apache.org/maven2) -> [Help 1]

Below I describe 3 ways how to handle this but there are also other solutions available. Check reference at the bottom.

If you plan on using your Project as a dependency:

The simplest solution is to manually install the JAR into the local maven repository. Using the example from stackoverflow:

With the maven entry:

<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>10.2.0.3.0</version>

Run the following command in the command line:

mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc14 \
     -Dversion=10.2.0.3.0 -Dpackaging=jar -Dfile=ojdbc.jar -DgeneratePom=true

If you plan on using your Project as a dependency & want the process automated:

Instead of installing the JAR to the repository manually, there’s actually a plugin for that – thanks Chris for the info.

Add the following entry:

<build>
 <plugins>
 <plugin>
 <groupId>org.apache.maven.plugins</groupId>
 <artifactId>maven-install-plugin</artifactId>
 <inherited>false</inherited>
 <executions>
 <execution>
 <id>install-external</id>
 <phase>clean</phase>
 <configuration>
 <file>${basedir}/lib/ojdbc14.jar</file>
 <repositoryLayout>default</repositoryLayout>
 <groupId>com.oracle</groupId>
 <artifactId>ojdbc14</artifactId>
 <version>10.2.0.3.0</version>
 <packaging>jar</packaging>
 <generatePom>true</generatePom>
 </configuration>
 <goals>
 <goal>install-file</goal>
 </goals>
 </execution>
 </executions>
 </plugin>
 </plugins>
 </build>

If your don’t plan on using your Project as a dependency in another project:

  1. Enter in your POM.xml a relative or absolute path denoting the JAR location, for example:
    <dependency>
    <groupId>ojdbc14</groupId>
    <artifactId>ojdbc14</artifactId>
    <version>10.2.0.3.0</version>
    <scope>system</scope>
    <systemPath>${project.basedir}/../lib/ojdbc14.jar</systemPath>
    </dependency>
  2. Add the jar file into your project.
    for my project I download the JAR file from http://www.oracle.com/technetwork/apps-tech/jdbc-10201-088211.html and added the file ojdbc14.jar to the project/lib folder.

Reference:

 



Menelaos Bakopoulos

Mr. Menelaos Bakopoulos is currently pursuing his PhD both at Center for TeleInFrastruktur (CTiF) at Aalborg University (AAU) in Denmark and Athens Information Technology (AIT) in Athens, Greece. He received a Master in Information Technology and Telecommunications Systems from Athens Information Technology and a B.Sc. in Computer Science & Management Information Systems from the American College of Thessaloniki. Since April 2008 he has been a member of the Multimedia, Knowledge, and Web Technologies Group.

More Posts