Maven settings.xml服务器配置未注入Wagon实例

时间:2015-03-02 13:12:15

标签: java maven maven-wagon-plugin

使用maven-wagon-plugin和Maven 3.2.5,我试图覆盖KnownHostsProviderScpWagon的默认实现。这是我的配置:

的pom.xml:

<project>
...
    <build>
        <plugins>           
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>wagon-maven-plugin</artifactId>
                <version>1.0</version>
                <executions>
                    <execution>
                        <id>upload-assemblies</id>
                        <phase>deploy</phase>
                        <goals>
                            <goal>upload</goal>
                        </goals>
                        <configuration>
                            <serverId>serverX</serverId>
                            <fromDir>C:\localDir</fromDir>
                            <includes>*.zip,*.ear</includes>
                            <url>scp://userY@serverX.host</url>
                            <toDir>/remoteDir</toDir>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <extensions>
            <extension>
                <groupId>org.apache.maven.wagon</groupId>
                <artifactId>wagon-ssh</artifactId>
                <version>2.8</version>
            </extension>
        </extensions>
    </build>
</project>

的settings.xml:

<servers>
    <server>
        <id>serverX</id>
        <configuration>
            <knownHostsProvider implementation="org.apache.maven.wagon.providers.ssh.knownhost.NullKnownHostProvider">
                <hostKeyChecking>no</hostKeyChecking>
            </knownHostsProvider>
        </configuration>
        <username>userY</username>
        <password>XXXXXXXX</password>
    </server>
</servers>

mvnDebug deploy之后运行DefaultWagonManager.getWagon(repository)并设置断点,我仍然看到FileKnownHostsProvider实例中设置了ScpWagon的实例。

我尝试过使用Maven 3.0.X和3.1.X,结果是一样的。我错过了什么?

0 个答案:

没有答案