mavenftpsmaven-wagon-pluginwagon

How to use Wagon maven plugin with FTPS


I'm using the below configuration to upload files to a remote server through FTPS protocol :

<extensions>
    <extension>
        <groupId>org.apache.maven.wagon</groupId>
        <artifactId>wagon-ftp</artifactId>
        <version>3.0.0</version>
    </extension>
</extensions>

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>wagon-maven-plugin</artifactId>
    <version>1.0-beta-3</version>
    <configuration>
        <skip>true</skip>
        <url>ftps://username:password@ip_address</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>

If i use only FTP instead of FTPS in the url parameter the goal is executed successfully and data are sent to the remote server, but when I use FTPS for security reasons, I get the below error :

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:wagon-maven-plugin:1.0-beta-3:upload (default-cli) on project XXX: The parameters 'url' for goal org.codehaus.mojo:wagon-maven-plugin:1.0-beta-3:upload are missing or invalid
    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.PluginParameterException: The parameters 'url' for goal org.codehaus.mojo:wagon-maven-plugin:1.0-beta-3:upload are missing or invalid
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.populatePluginFields(DefaultMavenPluginManager.java:641)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:594)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:121)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)

'


Solution

  • I solved the issue using the below configuration :

    Pom.xml :

     <extensions>
        <extension>
            <groupId>org.apache.maven.wagon</groupId>
            <artifactId>wagon-ftp</artifactId>
            <version>3.0.0</version>
        </extension>
    </extensions>
    
    <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>wagon-maven-plugin</artifactId>
        <version>1.0-beta-3</version>
        <configuration>
            <serverId>serverid</serverId>
            <skip>true</skip>
            <url>ftps://ip_address:port</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>
    

    Settings.xml :

       <server>
            <id>serverid</id>
            <username>XXXXXX</username>
            <password>XXXXXX</password>
            <configuration>
                <endpointChecking>false</endpointChecking>
                <securityProtocol>TLS</securityProtocol> 
                <implicit>true</implicit>
                <passiveMode>true</passiveMode>
            </configuration>
        </server>
    

    Thank you !