无法使用Wagon Maven FTPS传输大文件

时间:2019-12-18 11:40:52

标签: java maven maven-plugin maven-wagon-plugin wagon

我正在使用wagon插件通过FTPS / 990将构建文件发送到远程服务器,所有文件都已成功发送除了 meduim大文件(例如:75 MB),连接似乎已关闭我收到以下错误:

    org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:wagon-maven-plugin:2.0.0:upload (default-cli) on project XXXX: Error handling resource
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
    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:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error handling resource
    at org.codehaus.mojo.wagon.AbstractSingleWagonMojo.execute(AbstractSingleWagonMojo.java:67)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
    ... 20 more
Caused by: org.apache.maven.wagon.TransferFailedException: PUT request to: XXXX.war in ftp.server.id failed
    at org.apache.maven.wagon.AbstractWagon.putTransfer(AbstractWagon.java:448)
    at org.apache.maven.wagon.AbstractWagon.transfer(AbstractWagon.java:416)
    at org.apache.maven.wagon.AbstractWagon.putTransfer(AbstractWagon.java:390)
    at org.apache.maven.wagon.StreamWagon.put(StreamWagon.java:163)
    at org.codehaus.mojo.wagon.shared.DefaultWagonUpload.upload(DefaultWagonUpload.java:76)
    at org.codehaus.mojo.wagon.shared.DefaultWagonUpload.upload(DefaultWagonUpload.java:87)
    at org.codehaus.mojo.wagon.UploadMojo.execute(UploadMojo.java:112)
    at org.codehaus.mojo.wagon.AbstractSingleWagonMojo.execute(AbstractSingleWagonMojo.java:63)
    ... 22 more
Caused by: java.net.SocketException: Connection reset by peer: socket write error
    at java.net.SocketOutputStream.socketWrite0(Native Method)
    at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:111)
    at java.net.SocketOutputStream.write(SocketOutputStream.java:155)
    at org.apache.commons.net.io.SocketOutputStream.write(SocketOutputStream.java:71)
    at org.apache.maven.wagon.AbstractWagon.transfer(AbstractWagon.java:540)
    at org.apache.maven.wagon.AbstractWagon.putTransfer(AbstractWagon.java:435)

编辑:

在pom.xml中使用的配置下面:

    <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>wagon-maven-plugin</artifactId>
            <version>2.0.0</version>
            <configuration>
                <serverId>ftp.server.id</serverId>
                <url>ftps://IP_ADDRESS:990</url>
                <fromDir>${project.build.directory}</fromDir>
                <toDir>.</toDir>
            </configuration>
            <executions>
                <execution>
                    <id>upload</id>
                    <phase>deploy</phase>
                    <goals>
                        <goal>upload</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
    <extensions>
        <extension>
            <groupId>org.apache.maven.wagon</groupId>
            <artifactId>wagon-ftp</artifactId>
            <version>3.0.0</version>
        </extension>
    </extensions>

以及settings.xml中serverId的配置:

   <server>
        <id>ftp.server.id</id>
        <username>username</username>
        <password>password</password>
        <configuration>
            <endpointChecking>false</endpointChecking>
            <securityProtocol>TLSv1.2</securityProtocol> 
            <implicit>true</implicit>
            <passiveMode>true</passiveMode>
        </configuration>
    </server>

感谢帮助!

最诚挚的问候

1 个答案:

答案 0 :(得分:0)

检查FTP服务器配置的MAXSTOREFILESIZE,然后再次运行大文件。供参考,以下链接可能会帮助http://proftpd.org/docs/directives/configuration_full.html#MAXSTOREFILESIZE