为什么mvn安装Oracle JDBC ojdbc6 Jar总是出现“找不到用于前缀的插件”错误,并导致mvn构建失败?

时间:2018-10-26 11:07:48

标签: oracle maven jdbc

我通过以下两个链接下载ojdbc jar,并将其安装在Windows系统中本地

  1. Oracle JDBC ojdbc6 Jar as a Maven Dependency

  2. Maven install:install-file : specified file not exists

  3. https://www.mail-archive.com/users@maven.apache.org/msg83991.html

我最终使用以下命令(使用`逃脱-):

 mvn install:install-file `-Dfile=C:\Users\xxx\ojdbc6.jar `-DgroupId=com.oracle `-DartifactId=ojdbc6 `-Dversion=11.2.0.2.0 `-Dpackaging=jar `-DgeneratePom=true

但我仍然遇到以下错误:

[ERROR] No plugin found for prefix '`-Dfile=C' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (C:\Users\peter\.m2\repository), central (https://repo.maven.apache.org/maven2)] -> [Help 1]

此外,虽然看起来像上面那样,但ojdbc jar安装在.m2 / repository下,当我将mvn install运行到项目时,我仍然得到:

Failure to find com.oracle:ojdbc6:jar:11.2.0.2.0 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]

我该如何解决?

1 个答案:

答案 0 :(得分:1)

为什么要在命令中加上反引号(`)?尝试在不使用反引号的情况下运行它。

mvn install:install-file -Dfile=C:\Users\xxx\ojdbc6.jar -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0.2.0 -Dpackaging=jar -DgeneratePom=true