mavenftprpm-maven-plugin

How to download folder from ftp with maven


I want pack 5 GB resources from ftp to rpm's with rpm-maven-plugin.

Is it possible to download ftp directory using maven? If so, is it possible to use for authentication username and password from the settings.xml?


Solution

  • For recursively copy ftp directory best decision is

    ...
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-antrun-plugin</artifactId>
                    <version>1.8</version>
                    <configuration>
                        <target>
                            <ftp action="get"
                                 server="192.168.1.1"
                                 remotedir="remoteDir"
                                 userid="anonymous"
                                 password="anonymous">
                                <fileset dir="${project.build.directory}">
                                    <include name="**/*.*"/>
                                </fileset>
                            </ftp>
                        </target>
                    </configuration>
                    <executions>
                        <execution>
                            <id>download-from-ftp</id>
                            <phase>generate-resources</phase>
    
                            <goals>
                                <goal>run</goal>
                            </goals>
                        </execution>
                    </executions>
                    <dependencies>
                        <dependency>
                            <groupId>commons-net</groupId>
                            <artifactId>commons-net</artifactId>
                            <version>1.4.1</version>
                        </dependency>
                        <dependency>
                            <groupId>org.apache.ant</groupId>
                            <artifactId>ant-commons-net</artifactId>
                            <version>1.8.1</version>
                        </dependency>
                    </dependencies>
                </plugin>
    ...