记录一次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