burtsevyg
burtsevyg

Reputation: 4076

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?

Upvotes: 1

Views: 427

Answers (2)

burtsevyg
burtsevyg

Reputation: 4076

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>
...

Upvotes: 0

S. Pauk
S. Pauk

Reputation: 5318

Please consider using Maven Wagon Plugin. It provides support for FTP as well.

Upvotes: 1

Related Questions