29

When I try to use the oracle dependency -

<dependency>
    <groupId>com.oracle</groupId>
    <artifactId>ojdbc14</artifactId>
    <version>10.2.0.4.0</version>
</dependency>

I receive a compile time build error - "Missing artifact com.oracle:ojdbc14:jar:10.2.0.4.0". This error is displayed when I hover over error marker (left of ) in attached image -

enter image description here

Is there an issue with this dependency or something I'm doing wrong ?

blue-sky
  • 51,962
  • 152
  • 427
  • 752

14 Answers14

27

I followed these steps and solved (for version 10.2.0.4.0):

  1. Add dependency with maven to your pom.
  2. Download the missing file that maven can't find
  3. Put the downloaded file into the repository: .m2\repository\com\oracle\ojdbc14\10.2.0.4.0\
  4. Refresh pom.xml and the error message should be gone.
Alain Pannetier
  • 9,315
  • 3
  • 41
  • 46
Kumite
  • 271
  • 3
  • 5
23

There is no such artifact in maven central repository: http://repo1.maven.org/maven2/com/oracle/ojdbc14/10.2.0.4.0 (only pom).

I guess due to some licensing issues you must download the file manually from JDBC, SQLJ, Oracle JPublisher and Universal Connection Pool (UCP) download page.

Tomasz Nurkiewicz
  • 334,321
  • 69
  • 703
  • 674
  • Perhaps it pays off to run a local maven repository as a mirror. This enables you to include artifacts that are not available in "official" repos in your own repo. – migu Jan 25 '12 at 17:45
  • 6
    Why would a POM file exist if there no such available jar file, what is the use ? Is it so as "migu" states, I can host the file in my own repository using a standardized pom file. How is a pom file entry with no corresponding artifact/jar useful ? – blue-sky Jan 25 '12 at 19:36
  • 1
    @migu: maybe the authors of the artifact wanted to suggest/enforce naming convention of `groupId`/`artifactId` while the JAR itself has to be downloaded manually (and uploaded with suggested naming?) Still, this is unexpected – Tomasz Nurkiewicz Jan 26 '12 at 10:00
  • i have the same error, i downloaded the file manually and placed next to the corresponding pom in the local maven directory, but the error wont go away. anything else i need to do? – Neets Feb 12 '12 at 16:44
  • 2
    There are lot of items in repositories that only host the pom. Reason is that you can use poms to calculate dependencies, work out parent pom relationships etc. This is needed time to time even when actual .jar cannot be provided for whichever reason. – eis Aug 04 '13 at 12:06
13

Install the required jar as follows:

  1. Copy ojdbc14.jar to D:\
  2. Go to D:\ and execute the following maven command:

D:>mvn install:install-file -Dfile=ojdbc14.jar -DgroupId=com.oracle -DartifactId=ojdbc14 -Dversion=10.2.0.4.0 -Dpackaging=jar

  1. add dependency pom.xml

    <dependency>
        <groupId>com.oracle</groupId>
        <artifactId>ojdbc14</artifactId>
        <version>10.2.0.4.0</version>
    </dependency>
    

for detail see : http://softwarecave.org/2014/06/14/adding-external-jars-into-maven-project/

Percy Vega
  • 1,449
  • 1
  • 16
  • 13
  • 1
    Tried everything else and only this WORKED! Thank you. – Percy Vega Jan 09 '15 at 19:38
  • For license reasons Oracle does not publish its drivers on Maven Central. First download the file **ojdbc14.jar** (by ex) from Oracle.com. Then If you do a cd in the directory where the jar was downloaded you can run exactly the same command in Linux and Windows. `mvn install:install-file -Dfile=ojdbc14.jar -DgroupId=com.oracle -DartifactId=ojdbc14 -Dversion=10.2.0.4.0 -Dpackaging=jar` – Rudy Vissers Jun 16 '15 at 12:50
  • After you have executed `mvn install` you will find the file ojdbc14-10.2.0.4.0.jar into the local repository.(.m2/repository/com/oracle/ojdbc14/10.2.0.4.0) – Rudy Vissers Jun 16 '15 at 12:56
  • My pom.xml had groupId `com.oracle.jdbc`, not `com.oracle`. After making the necessary changes, it worked! – Rasshu Dec 11 '17 at 23:26
  • Why does it has to be D:\? It could be any directory. – aled Nov 07 '18 at 00:50
4

I took the route of manually downloading the oracle ojdb14 jar and pom file, but instead of manually adding them to my local repo, I used maven:

    § mvn install:install-file -Dfile=ojdbc14-10.2.0.2.jar -DpomFile=ojdbc14-10.2.0.2.0.pom

This insured they were correctly installed in my local repo (see http://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html)

3

Try this working fine in oracle maven dependency

<repositories>
<!-- Repository for ORACLE ojdbc6. -->
<repository>
    <id>codelds</id>
    <url>https://code.lds.org/nexus/content/groups/main-repo</url>
</repository>

<dependencies> 
<dependency>
    <groupId>com.oracle</groupId>
    <artifactId>ojdbc6</artifactId>
    <version>11.2.0.3</version>
</dependency>

Nithiy
  • 39
  • 5
  • 2
    I've search for the repository you have mentioned in the example. Well it reveals to be the "The Church of Jesus Christ of Latter-day Saints" ... mmmhhh, it's not a trustful source. – Brain Sep 04 '15 at 11:15
2

I had the same problem and that's how you can fix it:

  1. go to 1. https://code.lds.org/nexus/#welcome and search for ojdbc;
  2. Select one version from the list, copy the XML configuration for Maven that you will find on the right side and paste it in your pom.xml;
  3. Add a new repository in your pom.xml:

    <repositories> <repository> <id>codelds</id> <url>https://code.lds.org/nexus/content/groups/main-repo</url> </repository> </repositories>

1

To complement the other answer: It is generally advisable to check if an artifact is available in the repositories you use for your build. If this is not the case, you should consider running your own repository. This already pays off as soon as you want to use your own libraries with maven builds.

migu
  • 1,371
  • 1
  • 14
  • 23
0

Do NOT use stone-age driver and rather the newest 11g one. Which you will deploy to your local Nexus instance.

Michael-O
  • 18,123
  • 6
  • 55
  • 121
0

There is one repo that provides the jar. In SBT add a resolver similar to this: "oracle driver repo" at "http://dist.codehaus.org/mule/dependencies/maven2"

and a dependency: "oracle" % "ojdbc14" % "10.2.0.2"

You can do the same with maven. pom.xml and jar are available (http://dist.codehaus.org/mule/dependencies/maven2/oracle/ojdbc14/10.2.0.2/).

yǝsʞǝla
  • 16,272
  • 2
  • 44
  • 65
0

How it worked for me

1) Downloaded required jar 2) Installed Jar using mvn command 3) Make changes in pom.xml file \ use dependency FE to make changes

Shally Dhar
  • 121
  • 1
  • 3
  • 6
0

Below should work as per this link which has been updated on Feb, 2016.

<dependency>
 <groupId>com.oracle.jdbc</groupId>
 <artifactId>ojdbc7</artifactId>
 <version>12.1.0.2</version>
</dependency>
Barani r
  • 2,119
  • 1
  • 25
  • 24
0

I solved it by placing the jar in the .m2 folder and in pom adding the tag

<url>
http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/index.html
</url>
javalearner_heaven
  • 483
  • 1
  • 6
  • 21
0

I had the same problem and its working now by adding below in build.gradle.

repositories {
    mavenCentral()
    jcenter()  // Adding this in repositories resolved the issue
}

compile('com.oracle:ojdbc6:11.2.0.3')`
Suraj Rao
  • 29,388
  • 11
  • 94
  • 103
prathap K
  • 91
  • 1
  • 1
  • 10
0

These steps worked for me. I have java 1.8 and maven 3.6 on my machine. The same process failed with java 1.7

  1. Download the relevant jar files from the oracle website (Link shown below) http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/index.html

  2. Extract the jar files to a specific folder on your machine

  3. Ensure you have maven AND java on your path by running mvn -version command on your terminal (Im using Windows 10 btw.

    C:\Windows\system32>mvn -version

You will get something like this if all is fine .

Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10       -24T20:41:47+02:00)
Maven home: C:\apache-maven-3.6.0\bin\..
  1. Add the downloaded jar file to your maven repository by running the command below.

    C:\Windows\system32>mvn install:install-file -Dfile=C:\\Users\\Mwagiru\\Desktop\\Projects\\BPR\ojdbc-full\\OJDBC-Full\\ojdbc7.jar -DgroupId=com.oracle -DartifactId=ojdbc7 -Dversion=12.1.0 -Dpackaging=jar -

(Remember to update the command with the location where you unzipped your ojdbc jar file)

  1. Maven will fetch any plugins needed and update specified ojdbc jar file to your local repository

See sample out put below :

    [INFO] Scanning for projects...
    Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom
    Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom (3.9 kB at 1.7 kB/s)INFO] Installing C:\Users\Mwagiru\Desktop\Projects\BPR\ojdbc-full\OJDBC-Full\ojdbc7.jar to C:\Users\Mwagiru\.m2\repository\com\oracle\ojdbc7\12.1.0\ojdbc7-12.1.0.jar
[INFO] Installing C:\Users\Mwagiru\AppData\Local\Temp\mvninstall581357638187646

    6278.pom to C:\Users\Mwagiru\.m2\repository\com\oracle\ojdbc7\12.1.0\ojdbc7-12.1.0.pom
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time:  27.711 s
    [INFO] Finished at: 2018-11-21T13:08:37+02:00
    [INFO] ------------------------------------------------------------------------
  1. You may now add oracle depedency to your projects by adding it to your pom files. See sample below.

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