将此 JAR 放入本地存储库的正确方法是什么?
我正在使用 Maven 3.0.3。显然,Oracle JDBC 驱动程序在公共 Maven 存储库中不可用,因此我只能将其安装到本地存储库中。所以我创建了这个文件,
~/.m2/repository/oracle/oracle/10.2.0.3.0/classes12.jar
我在我的 pom.xml 文件中有这个文件......
<dependency>
<groupId>oracle</groupId>
<artifactId>classes12</artifactId>
<version>10.2.0.3.0</version>
</dependency>
但是在运行 Maven 时,我收到了这个错误。如何构建我的本地存储库? - 戴夫
[ERROR] Failed to execute goal on project infinitiusa_leads_testing: Could not resolve dependencies for project infinitiusa_leads_testing:infinitiusa_leads_testing:jar:1.0-SNAPSHOT: Failure to find oracle:classes12:jar:10.2.0.3.0 in http://repo1.maven.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
I'm using Maven 3.0.3. Evidently, the Oracle JDBC drivers are not available in a public Maven repo, so I'm reduced to installing it to my local one. So I created this file
~/.m2/repository/oracle/oracle/10.2.0.3.0/classes12.jar
I have this in my pom.xml file …
<dependency>
<groupId>oracle</groupId>
<artifactId>classes12</artifactId>
<version>10.2.0.3.0</version>
</dependency>
Yet upon running maven, I'm getting this error. How do I structure my local repo? - Dave
[ERROR] Failed to execute goal on project infinitiusa_leads_testing: Could not resolve dependencies for project infinitiusa_leads_testing:infinitiusa_leads_testing:jar:1.0-SNAPSHOT: Failure to find oracle:classes12:jar:10.2.0.3.0 in http://repo1.maven.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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,您必须安装存储库中的文件,而不仅仅是将其复制到正确的目录。请参阅答案:在 Maven 存储库中查找 Oracle JDBC 驱动程序。
其次,目录其实也不对。对于您在 pom.xml 中提供的依赖项,它应该位于:
但这是由
install:install-file
处理的,不要手动操作存储库目录(除了删除一些东西,maven 有时感到困惑并且需要重新启动,但这是一个不同的故事)。顺便说一句,将
com.oracle
视为groupId
。此外,maven 通常会提供非常准确的命令行,您应该运行该命令行来在本地存储库中安装缺少的依赖项。不知道为什么你的情况没有发生。
First of all, you must install the file in the repository, not only copy it to the right directory. See the answer: Find Oracle JDBC driver in Maven repository.
Secondly, the directory is actually not right. For the dependency you provided in pom.xml it should lie in:
But this is taken care of by
install:install-file
, don't manipulate the repository directory manually (except deleting some stuff, maven sometimes gets confused and it needs restart, but that's a different story).BTW consider
com.oracle
asgroupId
.Also maven typically gives the very exact command line you should run to install the missing dependency in your local repository. Don't know why it didn't happen in your case.