首页 文章

Maven无法解析SNAPSHOT依赖项

提问于
浏览
3

我刚刚使用SNAPSHOT版本向Nexus部署了Maven多模块项目 .

部署的工件存在于Nexus快照存储库中,我可以通过Nexus界面直接下载它们 .

但是,当我将这些工件作为依赖项添加到另一个项目时,Maven无法解决它们 .

我收到以下错误:

Downloading: http://<nexus-url>/nexus/content/groups/public/<groupId>/<artifactId>/1.0-SNAPSHOT/maven-metadata.xml
Downloaded: http://<nexus-url>/nexus/content/groups/public/<groupId>/<artifactId>/1.0-SNAPSHOT/maven-metadata.xml (835 B at 15.1 KB/sec)
Downloading: http://<nexus-url>/nexus/content/groups/public/<groupId>/<artifactId>/1.0-SNAPSHOT/<artifactId>-1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.056s
[INFO] Finished at: Tue Mar 25 17:49:23 IST 2014
[INFO] Final Memory: 11M/234M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project my-project: Co
uld not resolve dependencies for project com.example:my-project:jar:2.0-SNAPSHOT: Could not find artifact <groupId>:<artifactId>:jar:1.0-SNAPSHOT in nexus (http://<nexus-url>/nexus/content/groups/public) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[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 rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyReso
lutionException

请注意,Maven不会尝试下载文件 maven-metadata.xml .

谢谢,Mickael


EDIT: Maven DOES下载文件 maven-metadata.xml . 使用 -U 没有帮助 .

似乎Maven尝试下载工件而不将SNAPSHOT转换为适合时间戳的方法 .

2 回答

  • 2

    也许您需要使用 -U 运行构建,这意味着"force update of dependencies even if you already have resolved them in the last 24 hours" .

    如果没有它,maven将只尝试每天一次解决这些快照依赖项,这可能是你已经完成的,所以你得到一个“缓存”响应,因为它不在那里 .

  • 0

    试试这个 .

    在nexus中,单击您的公共存储库并转到配置选项卡 .

    • 您将看到 Ordered Group RepositoriesAvailable Repositories .

    • 将部署工件的存储库从 Available Repositories 移动到 Ordered Group Repositories ,然后尝试使用 -U 标志运行构建 .

相关问题