首页 > 解决方案 > 如何部署到 Nexus Sonatype 新的 Maven 模块

问题描述

我正在为现有的 Maven 项目创建新模块。当我尝试mvn:install从 Idea 进行投影时,会出现以下错误:

[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for kz.alfabank:type-ortalyk-bazar:bundle:1.0
[WARNING] 'version' contains an expression but should be a constant. @ kz.alfabank:type-ortalyk-bazar:${kz.alfabank.type.ortalyk-bazar.version}, C:\Users\u8002\Documents\dev\alfa-bank\kz.alfabank.soa\kz.alfabank.soa\type-ortalyk-bazar\pom.xml, line 19, column 14
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building type-ortalyk-bazar 1.0
[INFO] ------------------------------------------------------------------------
Downloading: http://vserver266:8081/nexus/content/groups/public/org/apache/maven/plugins/maven-surefire-plugin/maven-metadata.xml
[WARNING] Could not transfer metadata org.apache.maven.plugins:maven-surefire-plugin/maven-metadata.xml from/to public (http://vserver266:8081/nexus/content/groups/public): Failed to transfer file: http://vserver266:8081/nexus/content/groups/public/org/apache/maven/plugins/maven-surefire-plugin/maven-metadata.xml. Return code is: 504 , ReasonPhrase:Connection Timed Out.
Downloading: http://vserver266:8081/nexus/content/groups/public/org/apache/maven/plugins/maven-install-plugin/maven-metadata.xml
[WARNING] Could not transfer metadata org.apache.maven.plugins:maven-install-plugin/maven-metadata.xml from/to public (http://vserver266:8081/nexus/content/groups/public): Failed to transfer file: http://vserver266:8081/nexus/content/groups/public/org/apache/maven/plugins/maven-install-plugin/maven-metadata.xml. Return code is: 504 , ReasonPhrase:Connection Timed Out.
Downloading: http://vserver266:8081/nexus/content/groups/public/org/apache/maven/plugins/maven-deploy-plugin/maven-metadata.xml
[WARNING] Could not transfer metadata org.apache.maven.plugins:maven-deploy-plugin/maven-metadata.xml from/to public (http://vserver266:8081/nexus/content/groups/public): Failed to transfer file: http://vserver266:8081/nexus/content/groups/public/org/apache/maven/plugins/maven-deploy-plugin/maven-metadata.xml. Return code is: 504 , ReasonPhrase:Connection Timed Out.
Downloading: http://vserver266:8081/nexus/content/groups/public/kz/alfabank/type-ortalyk-bazar/1.0/type-ortalyk-bazar-1.0.jar
Downloading: https://repo.maven.apache.org/maven2/kz/alfabank/type-ortalyk-bazar/1.0/type-ortalyk-bazar-1.0.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 03:03 min
[INFO] Finished at: 2018-10-11T14:01:00+06:00
[INFO] Final Memory: 14M/167M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project type-ortalyk-bazar: Could not resolve dependencies for project kz.alfabank:type-ortalyk-bazar:bundle:1.0: Could not find artifact kz.alfabank:type-ortalyk-bazar:jar:1.0 in public (http://vserver266:8081/nexus/content/groups/public) -> [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/DependencyResolutionException

我们使用 Sonatype Nexus 2.11.4 作为存储库。为什么 Maven 在 Nexus 存储库中寻找新创建的模块?似乎某些元数据文件无法从 Nexus 下载:/

标签: mavennexus

解决方案


如果依赖项在本地存储库中不可用,或者在当前模块构建之前没有构建或下载其他依赖项,即它在远程存储库中查找时。请在您的 .m2存储库中查找工件kz.alfabank:type-ortalyk-bazar:jar:1.0

注意:如果您在设置中使用 IntelliJ,请尝试离线模式


推荐阅读