mvn -deploy 报错Failed to deploy artifacts: Could not find artifact

尉迟子民
2023-12-01

问题报错:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project apollo: Failed to deploy artifacts: Could not find artifact com.ctrip.framework.apollo
:apollo:pom:0.8.0 in releases (http://ip:8081/nexus/content/repositories/) -> [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/MojoExecutionException

问题分析:从报错看无法找到apollo:pom:0.8.0 这个pom文件, 但是从私服Nexus上看releases仓Repository Path 的地址为
http://ip:8081/nexus/content/repositories/
于是想到路径可能不对,查找maven的setting.xml,发现里面有配置路径:

<properties>
    <releases.repo>http://ip:8081/nexus/content/repositories/</releases.repo>
    <snapshots.repo>http://ip:8081/nexus/content/repositories/</snapshots.repo>
</properties>

问题解决:
这个路径是公司其他同事配置好的,这个路径刚好与报错信息中的路径一致,路径与私服上这两个仓库的路径不一样,随修改之,

<properties>
    <releases.repo>http://ip:8081/nexus/content/repositories/releases/</releases.repo>
    <snapshots.repo>http://ip:8081/nexus/content/repositories/snapshots/</snapshots.repo>
</properties>
 类似资料: