Java pom.xml 中缺少工件 com.oracle:ojdbc6:jar:11.2.0

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25128219/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-10 23:41:11  来源:igfitidea点击:

Missing artifact com.oracle:ojdbc6:jar:11.2.0 in pom.xml

javamavenpom.xmlojdbcartifact

提问by soumitra chatterjee

Missing artifact com.oracle in pom.xml

pom.xml 中缺少工件 com.oracle

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.

我正在使用 Eclipse Luna 并从事一个 Maven 项目。当我在 pom.xml 中添加 ojdbc jar 的条目时,它在 xml 中给出错误。我找不到问题的任何原因,因为 groupId、artifactId 和 version 是正确的。

How can I fix the problem?

我该如何解决这个问题?

采纳答案by user3487063

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

由于 Oracle 许可限制,没有提供 ojdbc jar 的公共存储库。

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

您需要下载它并安装在您的本地存储库中。从Oracle获取 jar并使用

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

如果您使用的是 ojdbc7,这里是链接

回答by Novice

Download the oracle ojdbc driver from Oracle official website.

Oracle 官网下载 oracle ojdbc 驱动程序。

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

将 Oracle 驱动程序安装/添加到本地 maven 存储库 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=

通过 -Dfile= 指定下载的文件位置

Add the following dependency in your pom file

在你的 pom 文件中添加以下依赖项

<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.

使用与 mvn install 命令中指定的相同的 groupId/artifactId。最后清理你的项目。

回答by Srishti Sinha

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:

下载 jar,评论你之前的条目ojdbc6,并给出一个新的本地条目,如下所示:

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> 

回答by janakinaidu

try this one

试试这个

    <dependency>
        <groupId>com.hynnet</groupId>
        <artifactId>oracle-driver-ojdbc6</artifactId>
        <version>12.1.0.1</version>
    </dependency>

回答by Paul

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

将 ojdbc6.jar 放在 eclipse 的项目资源文件夹中。然后在你的 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>

回答by quangkid

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>

回答by Codemaker

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

这是由于maven存储库中缺少ojdbc6.jar。下载它点击这里

Add the dependency in the pom.xml file

在 pom.xml 文件中添加依赖

   <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.

在命令提示符下使用以下命令将 Oracle 驱动程序安装/添加到本地 Maven 存储库。

  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

  1. 打开命令提示符
  2. 将目录更改为 apache-maven/bin 文件夹,例如: cd C:\Users\Public\Documents\apache-maven-3.5.2\bin
  3. 输入命令

    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

例如: 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 (//)

注意:使用双反斜杠分隔文件夹 (//)

回答by 0m3rF

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

由于语法原因,您在将 jar 添加到 Maven 时可能会在 Windows 上遇到问题。

Try encapsulating -D parameters with double quotas like this;

尝试用这样的双配额封装 -D 参数;

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;

请注意,您应该在 pom.xml 中使用相同的 version/atifactId/groupId。在上面的命令之后你不能使用版本 11.2.0.3。你必须把他的放在你的 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

如果你想使用另一个版本,比如 12.1.0.1,你应该使用该版本或其他信息运行上面的命令

回答by akshay kenjale

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

您需要检查您的配置文件是否具有正确的值,例如系统路径和工件 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>