<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>wagon-maven-plugin</artifactId>
<version>1.0</version>
<configuration>
<fromFile>target/${project.build.finalName}.jar</fromFile>
<toFile>${project.build.finalName}.jar</toFile>
<url>scp://root:m77JHG5B37@10.201.16.30/home/</url>
<commands>
<command>cp /home/${project.build.finalName}.jar /home/${project.build.finalName}2.jar</command>
</commands>
<displayCommandOutputs>true</displayCommandOutputs>
</configuration>
</plugin>
<build>节点下:
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh</artifactId>
<version>2.10</version>
</extension>
</extensions>
会报错:
Failed to execute goal org.codehaus.mojo:wagon-maven-plugin:1.0:sshexec (default-cli) on project platform-newgen: Unable to create a Wagon instance for scp://root:m77JHG5B37@10.201.16.30/home/
暂时找不到解决方法。。
2023-2-7,记录解决办法:
1、 url中的路径/home去掉。
2、 command中的执行命令,不能有输出,有输出可能导致命令无法正常结束。