无法从发布仓库下载依赖工件
Posted
技术标签:
【中文标题】无法从发布仓库下载依赖工件【英文标题】:Can't download dependency artifact from release repo 【发布时间】:2017-07-28 16:52:31 【问题描述】:我正在构建一个继承父模块的 maven 项目。
<parent>
<groupId>com.xxx.dist</groupId>
<artifactId>com.xxx.dist.core.msp.service.pom</artifactId>
<version>0.1-SNAPSHOT</version> <!-- 0.1 for release -->
</parent>
<artifactId>com.lgc.dist.core.msp.service.kafka</artifactId>
父com.xxx.dist.core.msp.service.pom
的工件同时发布在快照存储库(版本 0.1-SNAPSHOT)和发布存储库(版本 0.1)中。
mvn deploy
用于部署快照。可以成功下载父pom:
[INFO] Downloading: https://repo.openearth.community/artifactory/distarch-maven-snapshots/com/xxx/dist/com.xxx.dist.core.msp.service.pom/0.1-SNAPSHOT/maven-metadata.xml
[INFO] Downloaded: https://repo.openearth.community/artifactory/distarch-maven-snapshots/com/xxx/dist/com.xxx.dist.core.msp.service.pom/0.1-SNAPSHOT/maven-metadata.xml (599 B at 1.9 KB/sec)
[INFO] Downloading: https://repo.openearth.community/artifactory/distarch-maven-snapshots/com/xxx/dist/com.xxx.dist.core.msp.service.pom/0.1-SNAPSHOT/com.xxx.dist.core.msp.service.pom-0.1-20170726.184445-38.pom
[INFO] Downloaded: https://repo.openearth.community/artifactory/distarch-maven-snapshots/com/xxx/dist/com.xxx.dist.core.msp.service.pom/0.1-SNAPSHOT/com.xxx.dist.core.msp.service.pom-0.1-20170726.184445-38.pom (14 KB at 664.4 KB/sec)
对于使用 maven 发布插件的发布版本,它似乎无法从发布仓库下载父 pom:
[INFO] Downloading: https://repo.openearth.community/artifactory/distarch-maven-snapshots/com/xxx/dist/com.xxx.dist.core.msp.service.pom/0.1/com.xxx.dist.core.msp.service.pom-0.1.pom
[INFO] Downloading: https://repo.openearth.community/artifactory/distarch-maven-staging/com/xxx/dist/com.xxx.dist.core.msp.service.pom/0.1/com.xxx.dist.core.msp.service.pom-0.1.pom
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for com.xxx.dist:com.xxx.dist.core.msp.service.kafka:[unknown-version]: Could not transfer artifact com.xxx.dist:com.lgc.dist.core.msp.service.pom:pom:0.1 from/to snapshots (https://repo.openearth.community/artifactory/distarch-maven-snapshots): Failed to transfer file: https://repo.openearth.community/artifactory/distarch-maven-snapshots/com/xxx/dist/com.xxx.dist.core.msp.service.pom/0.1/com.xxx.dist.core.msp.service.pom-0.1.pom. Return code is: 409 , ReasonPhrase:Conflict. and 'parent.relativePath' points at wrong local POM @ line 4, column 10
它试图在 maven 的 settings.xml
、distarch-maven-snapshots
和 distarch-maven-staging
中定义的两个 repos 中查找工件。该错误可能有点误导,因为它指的是无法从快照存储库而不是发布传输。我以前见过这个,它只是意味着它不能从snapshots
或staging
转移。
暂存仓库中确实存在 0.1 pom
如果我只是将整个 url https://repo.openearth.community/artifactory/distarch-maven-staging/com/xxx/dist/com.xxx.dist.core.msp.service.pom/0.1/com.xxx.dist.core.msp.service.pom-0.1.pom
粘贴到浏览器中,我可以显示 pom 文件。 snapshots
和 staging
仓库都设置在同一个 Artifactory 中。快照存储库工作时我无法从发布存储库中提取的原因可能是什么。
【问题讨论】:
【参考方案1】:似乎由于某种原因,POM 命名错误:
com.lgc.dist.core.msp.service.pom-0.1.pom
应该命名为:
com.lgc.dist.core.msp.service-0.1.pom
如您所见,您有“.pom-0.1.pom”,应该是“-0.1.pom”
你能尝试改变它,看看它是否有效吗?
【讨论】:
以上是关于无法从发布仓库下载依赖工件的主要内容,如果未能解决你的问题,请参考以下文章