Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8:deploy (default-cli) on proj

1. maven deploy报错 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8:deploy (default-cli) on project qiyi-bom: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter -> [Help 1]

image-20220613193412377

问题解决

  1. 在报错的springboot模块的pom文件中添加如下代码

    <distributionManagement>
            <repository>
                <id>nexus-releases</id>
                <name>local Release</name>
                <url>仓库地址</url>
            </repository>
            <snapshotRepository>
                <id>snapshots</id>
                <url>镜像仓库地址</url>
            </snapshotRepository>
    </distributionManagement>
    

    例:如果要发布到远程仓库

    <distributionManagement>
        <repository>
            <!--稳定版本不会频繁修改的jar的存储位置-->
            <id>maven-release</id>
            <url>http://XXXX/repository/maven-releases/</url>
        </repository>
        <snapshotRepository>
            <!--快照版本-->
            <id>maven-snapshots</id>
            <url>http://XXXX/repository/maven-snapshots/</url>
        </snapshotRepository>
    </distributionManagement>
    

    例:如果要发布到本地仓库

    <distributionManagement>
            <repository>
                <id>nexus-releases</id>
                <name>local Release</name>
                <url>file://D:/maven/qiyiiot</url>
            </repository>
            <snapshotRepository>
                <id>snapshots</id>
                <url>file://D:/maven/qiyiiot</url>
            </snapshotRepository>
    </distributionManagement>
    
  2. 修改当前maven环境的settings.xml文件添加如下代码

    <servers>
    		<!-- server | Specifies the authentication information to use when connecting 
    			to a particular server, identified by | a unique name within the system (referred 
    			to by the 'id' attribute below). | | NOTE: You should either specify username/password 
    			OR privateKey/passphrase, since these pairings are | used together. |-->
    	 <server>
            <id>nexus-releases</id> 
            <username>admin</username>
            <password>admin123</password>
          </server>
    
    
    		<!-- Another sample, using keys to authenticate. <server> <id>siteServer</id> 
    			<privateKey>/path/to/private/key</privateKey> <passphrase>optional; leave 
    			empty if not used.</passphrase> </server> -->
    </servers>
    

    注意这里的server的id要和前面的repository中的id对应起来,因为server就是起到一个仓库认证的作用,代码读pom.xml获取到id之后在server中找到对应id的username和password去认证

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
"Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project" 是一个 Maven 构建工具的错误信息,它表示在执行 Maven 构建过程中出现了问题。具体来说,这个错误信息表明在执行 deploy 目标时出现了问题。 Maven 是一个用于构建和管理 Java 项目的工具,它使用基于项目对象模型(Project Object Model,POM)的概念来管理项目的依赖关系、构建过程和部署等任务。 在 Maven 的构建过程中,deploy 目标用于将构建好的项目部署到远程仓库中,以供其他项目或者团队使用。然而,当出现 "Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project" 错误时,通常是由于以下原因之一: 1. 无法连接到远程仓库:可能是由于网络问题或者仓库配置错误导致 Maven 无法连接到指定的远程仓库。 2. 权限问题:可能是由于没有足够的权限将构建好的项目部署到远程仓库。 3. 依赖关系错误:可能是由于项目的依赖关系配置错误导致 Maven 在部署过程中无法解析依赖项。 为了解决这个问题,你可以尝试以下几个步骤: 1. 检查网络连接:确保你的网络连接正常,并且可以访问远程仓库。 2. 检查仓库配置:检查你的 Maven 配置文件(settings.xml)中的仓库配置是否正确,并且你有足够的权限进行部署操作。 3. 检查依赖关系:检查项目的依赖关系配置是否正确,并且所有的依赖项都能够正确解析。 如果以上步骤都没有解决问题,你可以尝试搜索具体的错误信息或者提供更多的错误日志信息,以便更好地定位和解决问题。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值