2013-06-04 41 views
1

我想通过scp在ec2 ubuntu实例上使用maven-wagon-plugin复制一些puppet文件。我已将我的私钥文件的路径添加到我的settings.xml文件中,并在我的pom.xml文件中定义了该插件的用法(请参见下文)。如何通过maven-wagon-ssh/scp在ec2实例上安装文件?

我可以用腻子连接到机器上。此外,旅行车似乎能够esatblish的连接,因为它告诉我:

The authenticity of host 'ec2-....compute-1.amazonaws.com' can't be established. 
    RSA key fingerprint is 79:..:c7. 
    Are you sure you want to continue connecting? (yes/no): yes 

然而,该插件告诉我,我的身份验证是错误的:

[ERROR] Failed to execute goal org.codehaus.mojo:wagon-maven-plugin:1.0-beta- 
    4:upload (upload-puppet-module) on project ...: 
    Unable to create a Wagon instance for scp://ec2-...compute-1.amazonaws.com/: 
    Cannot connect. Reason: Auth fail -> [Help 1] 

我的settings.xml看起来是这样的:

... 
    <server> 
     <id>ec2-node</id>      
     <username>ubuntu</username>   
     <privateKey>.../path/to/privatekey.ppk</privateKey>   
    </server>   
    ... 

我的pom.xml看起来是这样的:

<build> 
    <extensions> 
     <extension> 
      <groupId>org.apache.maven.wagon</groupId> 
      <artifactId>wagon-ssh</artifactId> 
      <version>2.4</version> 
     </extension> 
    </extensions> 
    <plugins> 
     <plugin> 
      <groupId>org.codehaus.mojo</groupId> 
      <artifactId>wagon-maven-plugin</artifactId> 
      <version>1.0-beta-4</version> 
      <executions> 
       <execution> 
        <id>upload-puppet-module</id> 
        <phase>pre-integration-test</phase> 
        <goals> 
         <goal>upload</goal> 
        </goals> 
        <configuration> 
         <id>ec2-node</id> 
         <fromDir>${basedir}/src/main/resources/puppet-module</fromDir> 
         <includes>*</includes> 
         <url>scp://ec2-...compute-1.amazonaws.com/</url> 
         <toDir>/etc/puppet/modules/</toDir> 
         <filePermissions>664</filePermissions> 
         <directoryPermissions>775</directoryPermissions>    
        </configuration> 
       </execution> 
      </executions> 

任何建议我可以做的,使其工作?

在此先感谢!

+0

欲了解更快的帮助文章简短的自包含正确示例。 –

+0

我已经使用此[示例](http://mojo.codehaus.org/wagon-maven-plugin/usage.html) –

回答

2

我在pom.xml中有拼写错误。 rewritting相应的块后,它的工作:)

前:

<plugins> 
    <plugin> 
    ... 
    <configuration> 
     <id>ec2-node</id> <-- Wrong 
    ... 

后:

<plugins> 
    <plugin> 
    ... 
    <configuration> 
     <serverId>ec2-node</serverId> <-- Right 
    ... 

的处理的认证信息,在settings.xml定义,即刻奏效。

+0

Tx进行配置。在我的情况下,我忘了在设置文件中设置用户名。 – fvisticot

+0

我正在使用,但仍然得到了“Auth fail”问题,不确定它是否连接到known_hosts文件,因为我没有设置windows用户,使用在settings.xml中设置的用户名设置:-( –

相关问题