开发者

Using maven to copy war via ssh

开发者 https://www.devze.com 2023-04-07 21:01 出处:网络
I want to copy war file via ssh. I have the following pom: <plugin> <groupId>org.codehaus.mojo</groupId>

I want to copy war file via ssh. I have the following pom:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>wagon-maven-plugin</artifactId>
    <version>1.0-beta-3</version>
    <executions>
      <execution>
        <id>default-cli</id>
        <goals>
          <goal>upload-single</goal>
        </goals>
        <configuration>
          <fromFile>${project.build.directory}/${project.build.finalName}.war</fromFile>
          <toFile>ROOT.war</toFile>
          <url>scpexe://my.server.com</url>
          <serverId>my.server.id</serverId>
        </configuration>
      </execution>
    </executions>
</plugin>

When I trying to execute mvn wagon:upload-single, I got the following message:

Embedded error: Error executing command for transfer
Exit code 255 - Permission denied (publickey,gssapi-with-开发者_高级运维mic,password).

My settings.xml have proper username and password set. Also i can copy file to remote host manually without any propblem via scp.

Please, help me to solve this problem.


It works for me if I change

<toFile>ROOT.war</toFile>
<url>scpexe://my.server.com</url>

to

<toFile>/tmp/ROOT.war</toFile>
<url>scp://my.server.com</url>


You copy your file to the root folder. If you use this:

<toFile>ROOT.war</toFile>
<url>scpexe://my.server.com</url>

Then it is like saying: copy to my.server.com, us this file path: /ROOT.war

It is unlikely you have access to that folder.

Try using for example your home folder:

<toFile>/home/username/ROOT.war</toFile>
<url>scpexe://my.server.com</url>
0

精彩评论

暂无评论...
验证码 换一张
取 消