mvn install:install-file无法在正确的位置安装ojdbc7.jar

时间:2018-10-24 17:26:33

标签: java eclipse maven

我很难在正确的位置安装此ojdbc7 JAR文件。我在Windows 10命令提示符下尝试了以下操作,并收到了BUILD SUCCESS消息,如下所示:

C:\Users\john>mvn install:install-file -Dfile=C:\ojdbc7.jar -DgroupId=com.oracle -DartifactId=ojdbc7 -Dversion=12.1.0.1 -Dpackaging=jar
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.4:install-file (default-cli) @ standalone-pom ---
[INFO] Installing C:\ojdbc7.jar to C:\Users\l-john\.m2\repository\com\oracle\ojdbc7\12.1.0.1\ojdbc7-12.1.0.1.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.381 s
[INFO] Finished at: 2018-10-24T12:09:04-05:00
[INFO] ------------------------------------------------------------------------

但是,当我进入12.1.0.1文件夹(位于此处C:\Users\john\.m2\repository\com\oracle\ojdbc7\12.1.0.1)时,我仅看到以下文件: enter image description here

对于我的Maven项目之一,eclipse(版本2018-19)正在尝试访问JAR文件,并且我不断收到BUILD FAILURE消息,由于该文件不存在,因此很明显:

BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.208 s
[INFO] Finished at: 2018-10-24T12:15:39-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project MyProject: Could not resolve dependencies for project com.company.ii:MyProject:war:0.1: Could not find artifact com.oracle.jdbc:ojdbc7:jar:12.1.0.1 in spring-releases (https://repo.spring.io/libs-release) -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.

在我的pom.xml中,确实有如下定义的依赖项:

enter image description here

我在做错什么吗?请让我知道是否需要执行其他测试?

2 个答案:

答案 0 :(得分:1)

我可以看到在mvn安装命令中-DgroupId不正确,您没有给出“-DgroupId = com.oracle.jdbc” ,而是给出了“-DgroupId = com .oracle”

答案 1 :(得分:0)

Maven告诉您它正在将jar安装到

C:\ Users \ l-john \ .m2 \ repository \ com \ oracle \ ojdbc7 \ 12.1.0.1 \ ojdbc7-12.1.0.1.jar

但是您正在查看

C:\ Users \ john \ .m2 \ repository \ com \ oracle \ ojdbc7 \ 12.1.0.1

l-john vs john