Is there an issue with the oracle dependency?

2019-01-17 03:44发布

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 ?

标签: maven maven-3
14条回答
劳资没心,怎么记你
2楼-- · 2019-01-17 04:01

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/

查看更多
叛逆
3楼-- · 2019-01-17 04:01

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.

查看更多
Ridiculous、
4楼-- · 2019-01-17 04:01

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

查看更多
狗以群分
5楼-- · 2019-01-17 04:02

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>

查看更多
甜甜的少女心
6楼-- · 2019-01-17 04:03

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>
    
查看更多
可以哭但决不认输i
7楼-- · 2019-01-17 04:05

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')`
查看更多
登录 后发表回答