1

我正在尝试使用 maven-wagon-plugin 在 ec2 ubuntu 实例上通过 scp 复制一些 puppet 文件。我已将我的私钥文件的路径添加到我的 settings.xml 中,并在我的 pom.xml 中定义了插件的用法(见下文)。

我可以用腻子连接到机器。此外,wagon 似乎能够建立连接,因为它告诉我:

   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>

有什么建议我能做些什么,让它发挥作用?

提前致谢!

4

1 回答 1

3

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

前:

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

后:

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

在 settings.xml 中定义的已寻址身份验证信息立即生效。

于 2013-06-12T11:49:50.703 回答