Java 无法在 pom.xml 中为 ojdbc14 添加 Maven 依赖项

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19631982/
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-12 18:58:20  来源:igfitidea点击:

Unable to add Maven Dependency in pom.xml for ojdbc14

javaeclipseoraclemavenojdbc

提问by subhashis

I am trying to add dependency for ojdbc14in pom.xml

我正在尝试在 pom.xml 中为ojdbc14添加依赖

OS:WindowsXP(sp3) IDE:ECLIPSE(Juno) DB:Oracle 10G

操作系统:WindowsXP(sp3) IDE:ECLIPSE(Juno) DB:Oracle 10G

I am using m2e plugin in eclipse.

我在 eclipse 中使用 m2e 插件。

Steps I followed for adding ojdbc14.jar in local repository of maven

我在 maven 的本地存储库中添加 ojdbc14.jar 所遵循的步骤

  1. create a new project > maven project > org.codehaus.mojo.archetypes webapp-j2ee1.4
  2. move to that particular folder where is pom.xml file was located in command prompt.
  3. execute the command mvn clean.

  4. execute the command ' mvn install:install-file -Dfile="D:\oracle10g\jdbc\lib\ojdbc14.jar" -DgroupId=com.oracle -DartifactId=ojdbc14 -Dversion=10.2.0.1.0 -Dpackaging=jar '

  1. 创建一个新项目 > Maven 项目 > org.codehaus.mojo.archetypes webapp-j2ee1.4
  2. 移动到命令提示符中 pom.xml 文件所在的特定文件夹。
  3. 执行命令mvn clean

  4. 执行命令' mvn install:install-file -Dfile="D:\oracle10g\jdbc\lib\ojdbc14.jar" -DgroupId=com.oracle -DartifactId=ojdbc14 -Dversion=10.2.0.1.0 -Dpackaging=jar '

after this I got a build success message

在此之后,我收到一条构建成功消息

D:\Eclipse Workspace\BOOK_SHOP\BookShop>mvn install:install-file -Dfile="D:\oracle10g\jdbc\lib\ojdbc14.jar" -DgroupId=com.oracle -DartifactId=ojdbc14 -Dversion=10.2.0.1.0 -Dpackaging=jar

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building BookShop 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] --- maven-install-plugin:2.4:install-file (default-cli) @ BookShop ---
[INFO] Installing D:\oracle10g\jdbc\lib\ojdbc14.jar to D:\Maven Repository\Local Repository\com\oracle\ojdbc14.2.0.1.0\ojdbc14-10.2.0.1.0.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.375s
[INFO] Finished at: Mon Oct 28 14:38:03 IST 2013
[INFO] Final Memory: 2M/15M
[INFO] ------------------------------------------------------------------------

I have updated the global and local repository in Eclipse > Maven Repositories

我已经在 Eclipse > Maven Repositories 中更新了全局和本地存储库

5 . I add dependency in pom.xml

5 . 我在 pom.xml 添加依赖

enter image description hereenter image description here

在此处输入图片说明在此处输入图片说明

But I got error in my pom.xml file, and I am able to see the ojdbc14.jar file in my local repository. Is there any thing wrong in the steps I followed. Please help me out.

但是我的 pom.xml 文件出错了,我可以在本地存储库中看到 ojdbc14.jar 文件。我遵循的步骤有什么问题吗?请帮帮我。

Thanks

谢谢

采纳答案by Aaron Digulla

Eclipse and your command line Maven use different repositories. The command line uses D:\Maven Repository\Local Repository\while Eclipse uses %HOME%\.m2\repository

Eclipse 和您的命令行 Maven 使用不同的存储库。命令行使用,D:\Maven Repository\Local Repository\而 Eclipse 使用%HOME%\.m2\repository

Find out why the two disagree (usually, the path in settings.xmlis wrong or the two use different settings files).

找出两者不一致的原因(通常是路径settings.xml错误或两者使用不同的设置文件)。

回答by subhashis

I found the answer, I just change the user settings, because it was pointed to the old repository, I changed it to point to the new repository.

我找到了答案,我只是更改用户设置,因为它指向旧存储库,我将其更改为指向新存储库。

Windows > preferences > maven > User Settings

Windows > 首选项 > maven > 用户设置

Now its working fine.

现在它工作正常。

Thanks for your help Aaron Digulla :)

感谢您的帮助 Aaron Digulla :)

回答by abhi

Has the same problem , downloaded the jar from the oracle site . manually the jar in the maven local repo using below command

有同样的问题,从oracle站点下载了jar。使用以下命令在 Maven 本地存储库中手动生成 jar

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

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

solved the problem for me

为我解决了问题