2011-05-09 22 views
0

我正在使用Maven 3.0.3。很显然,Oracle JDBC驱动程序在公共Maven仓库中不可用,所以我将它简化为安装到本地仓库。所以,我在运行Maven创建这个文件将此JAR放入本地回购的正确方法是什么?

~/.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> 

然而,我得到这个错误。我如何构建我的本地回购? - 戴夫

[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 

回答

2

首先,您必须安装库中的文件,不仅把它复制到正确的目录。请参阅答案:Find Oracle JDBC driver in Maven repository

其次,该目录实际上是不正确的。对于在pom.xml中所提供的相关性应该在于:

~/.m2/repository/oracle/classes12/10.2.0.3.0/classes12-10.2.0.3.0.jar 

但是,这是由install:install-file照顾,不用手动操作库目录(除了删除一些东西,有时行家会产生混乱而它需要重新启动,但这是一个不同的故事)。

mvn install:install-file -DgroupId=oracle -DartifactId=classes12 \ 
-Dversion=10.2.0.3.0 -Dpackaging=jar -Dfile=classes12.jar 

BTW考虑com.oraclegroupId

此外,maven通常会给出非常确切的命令行,您应该运行它来在本地存储库中安装缺失的依赖项。不知道为什么它没有发生在你的情况。

+0

+1对于groupId命名提示:-) – Jan 2011-05-13 10:03:15

相关问题