0

我正在尝试使用scpwith将资源复制到服务器wagon

在下添加存储库的目的是什么distributionManagement

我的pom.xml长相是这样的

<distributionManagement>
            <repository>
                <id>iq</id>
                <url>ftp://server:port</url>
            </repository>
</distributionManagement>
<build>
    <extensions>
        <extension>
            <groupId>org.apache.maven.wagon</groupId>
            <artifactId>wagon-ftp</artifactId>
            <version>1.0-beta-6</version>
        </extension>
    </extensions>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>wagon-maven-plugin</artifactId>
            <version>1.0-beta-3</version>
             <extensions>true</extensions>
            <executions>
                <execution>
                    <phase>deploy</phase>
                    <goals>
                        <goal>copy</goal>
                    </goals>
                    <configuration>
                        <serverId>iq</serverId>
                        <fromDir>src/main/webapps</fromDir>
                        <url>scp:ftp://server:port</url>
                        <toDir>.iq/resources/</toDir>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>

我的 settings.xml 文件是

<servers>
    <server>
      <id>iq</id>
      <username>user</username>
      <password>pass</password>      
    </server>
</servers>

*错误是 *

    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy (default-deploy) on project iq-resources: Failed to deploy artifacts: Could not transfer artifact test.com.test:resources:jar:2.50.6.a from/to iq (ftp://server:port): Could not connect to server. Could not parse response code.
[ERROR] Server Reply: SSH-2.0-OpenSSH_4.3
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy (default-deploy) on project iq-resources: Failed to deploy artifacts: Could not transfer artifact test.com.test:resources:jar:2.50.6.a from/to  (ftp://server:port): Could not connect to server.
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:534)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to deploy artifacts: Could not transfer artifact :resources:jar:2.50.6.a from/to iq (ftp://server:port): Could not connect to server.
    at org.apache.maven.plugin.deploy.DeployMojo.execute(DeployMojo.java:189)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:107)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    ... 19 more
Caused by: org.apache.maven.artifact.deployer.ArtifactDeploymentException: Failed to deploy artifacts: Could not transfer artifact resources:jar:2.50.6.a from/to iq (ftp://server:port): Could not connect to server.
    at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:140)
    at org.apache.maven.plugin.deploy.DeployMojo.execute(DeployMojo.java:156)
    ... 21 more
Caused by: org.sonatype.aether.deployment.DeploymentException: Failed to deploy artifacts: Could not transfer artifact resources:jar:2.50.6.a from/to iq (ftp://server:port): Could not connect to server.
    at org.sonatype.aether.impl.internal.DefaultDeployer.deploy(DefaultDeployer.java:259)
    at org.sonatype.aether.impl.internal.DefaultRepositorySystem.deploy(DefaultRepositorySystem.java:380)
    at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:136)
    ... 22 more
Caused by: org.sonatype.aether.transfer.ArtifactTransferException: Could not transfer artifact  resources:jar:2.50.6.a from/to iq (ftp://server:port): Could not connect to server.
    at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(WagonRepositoryConnector.java:949)
    at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(WagonRepositoryConnector.java:940)
    at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$PutTask.flush(WagonRepositoryConnector.java:864)
    at org.sonatype.aether.connector.wagon.WagonRepositoryConnector.put(WagonRepositoryConnector.java:465)
    at org.sonatype.aether.impl.internal.DefaultDeployer.deploy(DefaultDeployer.java:253)
    ... 24 more
Caused by: org.apache.maven.wagon.authentication.AuthenticationException: Could not connect to server.
    at org.apache.maven.wagon.providers.ftp.FtpWagon.openConnectionInternal(FtpWagon.java:154)
    at org.apache.maven.wagon.AbstractWagon.openConnection(AbstractWagon.java:105)
    at org.apache.maven.wagon.AbstractWagon.connect(AbstractWagon.java:207)
    at org.sonatype.aether.connector.wagon.WagonRepositoryConnector.connectWagon(WagonRepositoryConnector.java:326)
    at org.sonatype.aether.connector.wagon.WagonRepositoryConnector.pollWagon(WagonRepositoryConnector.java:366)
    at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$PutTask.run(WagonRepositoryConnector.java:817)
    at org.sonatype.aether.connector.wagon.WagonRepositoryConnector.put(WagonRepositoryConnector.java:464)
    ... 25 more
Caused by: org.apache.commons.net.MalformedServerReplyException: Could not parse response code.
Server Reply: SSH-2.0-OpenSSH_4.3
    at org.apache.commons.net.ftp.FTP.__getReply(FTP.java:315)
    at org.apache.commons.net.ftp.FTP._connectAction_(FTP.java:364)
    at org.apache.commons.net.ftp.FTPClient._connectAction_(FTPClient.java:540)
    at org.apache.commons.net.SocketClient.connect(SocketClient.java:178)
    at org.apache.maven.wagon.providers.ftp.FtpWagon.openConnectionInternal(FtpWagon.java:119)
    ... 31 more
[ERROR] 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
4

1 回答 1

1

ftp并且scp是两种不同的协议。该错误是因为您正在尝试使用wagon-ftp库来执行scp.

首先检查您拥有的服务器到底是什么 - ftp 或 scp。如果ftp,您可能希望scp从 url 中删除。如果scp,那么您可能想要使用wagon-ssh库。

另请参阅wagon 文档以了解各种运输抽象。

于 2011-11-28T09:04:28.590 回答