Maven - 札记 - [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy


Centos - 目录


Maven - 札记 - Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy "default-deploy"on project xxx: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter

  • 一、问题描述
    • 1. 现象
    • 2. 原因
  • 二、解决方案


一、问题描述


1. 现象

执行 Maven deploy 生命周期提示以下信息:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project xxx: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter -> [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

2. 原因

deploy 插件 2.7 版本和 2.8 版本有配置上的差异。

  • 2.7 版本需要在项目的 pom.xml 文件中配置上传的仓库信息(以下内容仅供参考,请根据自己的仓库信息自行调整
    
    	
    		rdc-release
    		https://packages.aliyun.com/maven/repository/xxx-release-xxx/
    	
    	
    		rdc-snapshot
    		https://packages.aliyun.com/maven/repository/xxx-snapshot-xxx/
    	
    
    
  • 2.8 版本会使用 setting.xml 中的配置(以下内容仅供参考,请根据自己的仓库信息自行调整
    
    	
    		rdc
    		
    			
    				rdc-releases::default::https://packages.aliyun.com/maven/repository/xxx-release-xxx/
    			
    			
    				rdc-snapshots::default::https://packages.aliyun.com/maven/repository/xxx-snapshot-xxx/
    			
    		
    	
    
    

二、解决方案


根据自己情况选择对应解决方案

  • 不想在 pom.xml 配置仓库信息(解决方案:在 pom.xml 中指定 deploy 版本为 2.8+)
    
    	org.apache.maven.plugins
    	maven-deploy-plugin
    	2.8
    
    
  • 不想配置 deploy 版本信息,想使用 deploy 默认版本(解决方案:在 pom.xml 配置仓库信息)
    
    	
    		rdc-release
    		https://packages.aliyun.com/maven/repository/xxx-release-xxx/
    	
    	
    		rdc-snapshot
    		https://packages.aliyun.com/maven/repository/xxx-snapshot-xxx/
    	
    
    

你可能感兴趣的:(Maven,maven,java)