【发布时间】:2014-05-03 14:01:50
【问题描述】:
我刚刚使用 SNAPSHOT 版本将 Maven 多模块项目部署到 Nexus。
已部署的工件存在于 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。
谢谢, 迈克尔
编辑: Maven 确实下载了文件 maven-metadata.xml。使用-U 没有帮助。
似乎 Maven 尝试下载工件而不将 SNAPSHOT 转换为适当的时间戳。
【问题讨论】:
-
我相信你的错误信息被严重截断了。
-
@chad 谢谢,我已经编辑过了。
-
看起来它没有 artifact 的名称和组 ID。 . .它正在寻找
: :jar:1.0-SNAPSHOT 你的 pom 在依赖的声明中一定有错误。 -
你是对的!我在类型和分类器上犯了一个错误。现在可以了。但是,我在 Apache Karaf 中遇到了同样的问题,我试图添加一个作为 XML 文件部署在 Nexus 上的功能存储库。