40

Missing artifact com.oracle in pom.xml

I am using Eclipse Luna and working on a maven project. When I add the entry for ojdbc jar in pom.xml , it is giving error in the xml. I can't find any reason for the issue as groupId, artifactId and version are correct.

How can I fix the problem?

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
soumitra chatterjee
  • 2,268
  • 9
  • 26
  • 48
  • Have you manually added this jar to your local repo or specified a repo that contains it? – Beau Grantham Aug 04 '14 at 21:58
  • Possible duplicate of [Find Oracle JDBC driver in Maven repository](http://stackoverflow.com/questions/1074869/find-oracle-jdbc-driver-in-maven-repository) – zloster Apr 18 '17 at 07:56

12 Answers12

72

Due to Oracle license restriction, there are no public repositories that provide ojdbc jar.

You need to download it and install in your local repository. Get jar from Oracle and install it in your local maven repository using

mvn install:install-file -Dfile={path/to/your/ojdbc.jar} -DgroupId=com.oracle 
-DartifactId=ojdbc6 -Dversion=11.2.0 -Dpackaging=jar

If you are using ojdbc7, here is the link

user3487063
  • 3,672
  • 1
  • 17
  • 24
  • Also visit [http://stackoverflow.com/questions/9898499/oracle-jdbc-ojdbc6-jar-as-a-maven-dependency] for complete discussion on this topic – Jess Nov 23 '16 at 17:20
  • i placed the jar in the bin folder and ran this script: mvn install:install-file -Dfile=ojdbc6.jar -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.1.0.7.0 -Dpackaging=jar – Ryan Augustine Oct 16 '18 at 12:06
11

This is the quickest way to solve the problem but it's not recommended because its applicable only for your local system.

Download the jar, comment your previous entry for ojdbc6, and give a new local entry like so:

Previous Entry:

<!-- OJDBC6 Dependency -->
        <!-- <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc6</artifactId>
            <version>1.0</version>
            <scope>runtime</scope>
        </dependency> -->

New Entry:

<dependency>
        <groupId>com.oracle</groupId>
        <artifactId>ojdbc6</artifactId>
        <version>1.0</version>
        <scope>system</scope>
        <systemPath>${project.basedir}/lib/ojdbc6/ojdbc6.jar</systemPath>
        </dependency> 
Anil Agrawal
  • 2,748
  • 1
  • 24
  • 31
Srishti Sinha
  • 618
  • 1
  • 11
  • 23
  • What's this {project.basedir}? Checked the project location folder but couldn't find the lib folder as in "{project.basedir}/lib/". Can you help me locate it appropriately? – Kailas Jun 20 '17 at 14:10
  • @Kailas You need to download ojdbc6 jar from internet. This file location is anywhere in your system where you have put the jar. It is not present already. You decide the location. – Srishti Sinha Jun 22 '17 at 06:55
4

Place ojdbc6.jar in your project resources folder of eclipse. then add the following dependency code in your pom.xml

<dependency>
<groupId> oracle </groupId>
 <artifactId>ojdbc6</artifactId>
 <version>11.2.0</version>
  <scope>system</scope>
  <systemPath>${project.basedir}/src/main/resources/ojdbc6.jar</systemPath>
</dependency>
Paul
  • 41
  • 1
2

Download the oracle ojdbc driver from Oracle official website.

Install/Add Oracle driver to the local maven repository mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc7 -Dpackaging=jar -Dversion=12.1.0.1 -Dfile=ojdbc7.jar -DgeneratePom=true

Specify the downloaded file location via -Dfile=

Add the following dependency in your pom file

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

Use the same groupId/artifactId as specified in your mvn install command. Finally clean your project.

Novice
  • 557
  • 1
  • 7
  • 16
2

You might have problem on Windows while adding jar to maven because of syntax.

Try encapsulating -D parameters with double quotas like this;

mvn install:install-file "-Dfile=ojdbc6.jar" "-DgroupId=com.oracle" "-DartifactId=ojdbc6" "-Dversion=11.2.0" "-Dpackaging=jar" 

Be aware of you should use same version/atifactId/groupId inside your pom.xml. You can't use version 11.2.0.3 after command above. You have to put his in you pom.xml;

    <dependency>
        <groupId>com.oracle</groupId>
        <artifactId>ojdbc6</artifactId>
        <version>11.2.0</version>
    </dependency>

If you want to use another version, like 12.1.0.1, you should run above command with that version or other info

2

I had the same issue. Jenkins's build was falling because of this error..after long hours troubleshooting.

Link to download ojdbc as per your requirement - https://www.oracle.com/database/technologies/maven-central-guide.html

I have downloaded in my maven/bin location and executed the below command.

mvn install:install-file -Dfile=ojdbc8-12.2.0.1.jar -DgroupId=com.oracle -DartifactId=ojdbc8 -Dversion=12.2.0.1 -Dpackaging=jar

POM.xml

<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc8</artifactId>
<version>12.2.0.1</version>
</dependency>
Abhinay Gupta
  • 191
  • 2
  • 4
1

Add this is work for me

<repositories>
    <!-- Repository for ORACLE JDBC Driver -->
    <repository>
        <id>codelds</id>
        <url>https://code.lds.org/nexus/content/groups/main-repo</url>
    </repository>
</repositories>
quangkid
  • 1,287
  • 1
  • 12
  • 31
0

It's due to the missing of ojdbc6.jar in the maven repository. download it Click Here

Add the dependency in the pom.xml file

   <dependency>
        <groupId>com.oracle</groupId>
        <artifactId>ojdbc6</artifactId>
        <version>11.2.0</version>
    </dependency>

Install/Add Oracle driver to the local maven repository using the following command in command prompt.

  1. open command prompt
  2. change directory to the apache-maven/bin folder Eg: cd C:\Users\Public\Documents\apache-maven-3.5.2\bin
  3. type the command

    mvn install:install-file -Dfile={path/to/your/ojdbc.jar} -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0 -Dpackaging=jar

Eg: mvn install:install-file -Dfile=C://Users//Codemaker//Downloads//Compressed//ojdbc6.jar -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0 -Dpackaging=jar

NB: use double back slash to seperate folders (//)

Codemaker2015
  • 12,190
  • 6
  • 97
  • 81
0

You need to check your config file if it has correct values such as systempath and artifact Id.

    <dependency>
    <groupId>com.oracle</groupId>
    <artifactId>ojdbc6</artifactId>
    <version>1.0</version>
    <scope>system</scope>
    <systemPath>C:\Users\Akshay\Downloads\ojdbc6.jar</systemPath>
    </dependency> 
Rohan Rao
  • 2,505
  • 3
  • 19
  • 39
0

Sometimes even though the jar is available in the folder the error will not go way to overcome this just change a group id to a meaningful one.

Ajay Takur
  • 6,079
  • 5
  • 39
  • 55
-1

try this one

    <dependency>
        <groupId>com.hynnet</groupId>
        <artifactId>oracle-driver-ojdbc6</artifactId>
        <version>12.1.0.1</version>
    </dependency>
  • Still getting error Failure to find com.hynnet:oracle-driver-ojdbc6:jar:12.1.0.1 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced - – Saurabh Verma Oct 15 '19 at 10:19
-3

oracle driver. `

<dependency>
    <groupId>com.hynnet</groupId>
    <artifactId>jdbc-fo</artifactId>
    <version>12.1.0.2</version>
</dependency>

`

hynnet
  • 1