我正在尝试将Oracle JDBC作为maven依赖项添加到我的项目中.我已经在线阅读了多个教程,这些教程提出了添加第三方依赖关系的各种方法.
我选择了本地安装方法,但是(this person)我遇到了问题.
我运行以下命令来安装jar:
mvn install:install-file -Dfile={lib/ojdbc7.jar} -DgroupId=com.oracle -DartifactId=ojdbc7 -Dversion=12.1.0.1 -Dpackaging=jar
并成功:
[INFO] --- maven-install-plugin:2.3:install-file (default-cli) @ standalone-pom ---
[INFO] Installing /home//{lib/ojdbc7.jar} to /home//.m2/repository/com/oracle/ojdbc7/12.1.0.1/ojdbc7-12.1.0.1.jar
然后我将以下内容添加到我的pom中:
com.oracle
ojdbc7
12.1.0.1
然而,当我编译时,我得到以下内容:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.307s
[INFO] Finished at: Sat May 02 20:40:07 NZST 2015
[INFO] Final Memory: 8M/56M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project xxx: Could not resolve dependencies for project com.xxx:xxx:jar:1.0-SNAPSHOT: Failure to find com.oracle:ojdbc7:jar:12.1.0.1 in http://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]
[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.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
我玩过-U和-o标志无济于事.我也尝试通过首先将lib安装到lib目录中(正如Raghuram在另一个问题上所建议的那样)而没有任何改变.