Maven3.0.3 + artifactory 2.5 + ubuntu 11.10无法解析依赖

时间:2012-05-25 08:07:43

标签: maven maven-3

我只是使用maven + artifactory有这个奇怪的问题。我有一个项目,我首先使用maven-compiler 2.3.2和maven2构建。它成功构建,我能够部署在人工2.5中。

最终我添加了几个模块,其中一个需要使用maven-compiler-plugin 2.4,这也需要我安装maven3,因为我有几个错误。所以我的应用程序再次运行。

但是当我在新机器和maven编译结账时,我得到了ff错误:

Could not resolve dependencies for project com.xxxjar:0.0.1-SNAPSHOT: Failed to collect depend
encies for <list of jars>. Failure to find <snapshot> in <repo> was cached in the local repository, resolution will not be reattempted until the update interval of <repo> has elapsed or updates are forced.

奇怪的是,当我继续使用我首先使用maven2开发的第一台机器上的m2目录时,它编译时没有错误。很明显maven3会错过一些设置或jar?

此外,我尝试将我的快照存储库“maven snapshot version”设置为Unique,如其他论坛所述。我还尝试了几乎所有可以在artifactory存储库设置中配置的组合。

我的pom.xml分发设置:

<distributionManagement>
    <!-- <repository>
        <id>release</id>
        <name>xx</name>
        <url>xx-repo-release</url>
    </repository> -->
    <snapshotRepository>
        <id>snapshots</id>
        <name>xx</name>
        <url>xx-snapshots</url>
    </snapshotRepository>
</distributionManagement>

其他信息: 当我在另一台机器上运行安装时,我有:

2012-05-25 17:21:32,316 [pool-1-thread-3] [WARN ] (o.a.e.DownloadServiceImpl:343) - Sending HTTP error code 409: The repository 'xx-repo-release' rejected the artifact 'xx-repo-release:com/xx/xx/0.0.1-SNAPSHOT/xx-0.0.1-SNAPSHOT.pom' due to its snapshot/release handling policy..
2012-05-25 17:21:32,342 [pool-1-thread-13] [WARN ] (o.a.e.DownloadServiceImpl:343) - Sending HTTP error code 409: The repository 'xx-repo-release' rejected the artifact 'xx-repo-release:com/xx/xx/0.0.1-SNAPSHOT/xx-0.0.1-SNAPSHOT.pom' due to its snapshot/release handling policy..
2012-05-25 17:21:32,350 [pool-1-thread-7] [WARN ] (o.a.e.DownloadServiceImpl:343) - Sending HTTP error code 409: The repository 'libs-release-local' rejected the artifact 'libs-release-local:com/xx/xx/0.0.1-SNAPSHOT/xx-0.0.1-SNAPSHOT.pom' due to its snapshot/release handling policy..

settings.xml对于两台机器都是相同的。还有相同版本的maven。为什么它指向发布?

谢谢,
czetsuya

3 个答案:

答案 0 :(得分:1)

我认为另一种解决方案可能是运行以下命令: mvn clean install -U

答案 1 :(得分:0)

问题是依赖性问题。我有一个模型模块,它位于父pom项目下。虽然我能够在远程存储库中部署模型模块,但我忘了部署它的父级导致问题。

解决方案:http://czetsuya-tech.blogspot.com/2012/05/could-not-resolve-dependencies-for.html

答案 2 :(得分:0)

我已经指出了一个神秘的3.1.1.1 instalation并且在一个声明了log4j的依赖关系的项目中遇到了上述问题:log4j:1.2.17。

当在GAVC搜索中查找对artifactory的依赖时,只会在jcenter-cache repo中显示pom。

我的解决方案是运行以​​下命令:

mvn clean install -U

之后再次查看log4j:log4j:1.2.17与GAVC,现在看起来像是一个罐子。当然在我的笔记本电脑上下载了$ HOME / .m2 / repository / log4j / log4j / 1.2.17 / log4j-1.2.17.jar。

感谢mike.tihonchik。