记录一次wagon报错Failed to execute goal org.codehaus.mojo:wagon-maven-plugin:1.0:upload-single

本文记录了在执行Maven wagon上传时遇到的'Failed to execute goal org.codehaus.mojo:wagon-maven-plugin:1.0:upload-single'错误。问题根源在于fromFile路径与执行maven命令的目录不匹配,导致无法找到本地jar包。解决方案是检查并确保这两个路径的一致性。此外,还提到了Ubuntu系统中可能出现的scp报错情况,以及需要检查远程服务器目录权限和所有者是否与配置的用户匹配。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

记录一次wagon报错Failed to execute goal org.codehaus.mojo:wagon-maven-plugin:1.0:upload-single (default-cli) on xxx: Error handling resource

该报错是配置的fromFile路径和指定执行maven命令的目录不一致导致层级出错而找不到本地jar包位置,检查运行maven的目录和配置的路径是否正确即可。

<build>
        <extensions>
            <extension>
                <groupId>org.apache.maven.wagon</groupId>
                <artifactId>wagon-ssh</artifactId>
                <version>2.10</version>
            </extension>
        </extensions>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>wagon-maven-plugin</artifactId>
                <version>1.0</version>
                <configuration>
                    <serverId>${profiles.active}</serverId>
                    <fromFile>${profiles.module}/target/${profiles.jar}</fromFile>
                    <url><![CDATA[scp://${profiles.user}:${profiles.password}@${profiles.url}${profiles.path}/deplay]]></url>
                    <commands>
                        <command><![CDATA[${profiles.path}/${profiles.bulid}]]></command>
                    </commands>
                    <!-- 运行命令 mvn clean package wagon:upload-single wagon:sshexec-->
                    <!-- 执行环境变量 运行命令 mvn clean package wagon:upload-single -Pxxx wagon:sshexec-->
                    <displayCommandOutputs>true</displayCommandOutputs>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <!-- 环境 -->
    <profiles>
        <profile>
            <id>xxx</id>
            <properties>
                <profiles.active>xxx</profiles.active>
                <profiles.url>远端ip</profiles.url>
                <profiles.path>远端文件地址</profiles.path>
                <profiles.module>模块名称</profiles.module>
                <profiles.jar>jar包名称</profiles.jar>
                <profiles.user>远端服务器用户名</profiles.user>
                <profiles.password>远端服务器密码</profiles.password>
                <profiles.bulid>执行脚本</profiles.bulid>
            </properties>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <!-- clean package wagon:upload-single wagon:sshexec -->
        </profile>
    </profiles>

更新: 今天搭建新项目再次出现这个问题

1.第一种可能:scp报错,如果是Ubantu 系统可以看下这个
链接:Ubantu 系统 ssh 不能执行scp 报错:Algorithm negotiation fail
2.请检查上面配置的scp的url对应的目录权限 及 目录所有人 是否为下面配置的profiles.user登录服务器的user

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值