Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 757545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T15:22:33+00:00 2026-05-14T15:22:33+00:00

I’m using the FTP Ant task with maven-antrun-plugin <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-antrun-plugin</artifactId> <executions> <execution> <id>ftp</id>

  • 0

I’m using the FTP Ant task with maven-antrun-plugin

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-antrun-plugin</artifactId>
    <executions>
        <execution>
            <id>ftp</id>
            <phase>generate-resources</phase>
            <configuration>
                <tasks>
                    <ftp action="get"
                         server="${ftp.server.ip}"
                         userid="${ftp.server.userid}"
                         password="${ftp.server.password}"
                         remotedir="${ftp.server.remotedir}"
                         depends="yes" verbose="yes"
                         skipFailedTransfers="true"
                         ignoreNoncriticalErrors="true">
                        <fileset dir="target/test-classes/testdata">
                            <include name="**/*.html" />
                        </fileset>
                    </ftp>
                </tasks>
            </configuration>
            <goals>
                <goal>run</goal>
            </goals>
        </execution>
    </executions>
...

the problem is that my build fails when the folder ${ftp.server.remotedir} doesn’t exist.
I tried to specify

skipFailedTransfers="true"
ignoreNoncriticalErrors="true

but these don’t fix the problem and the build keeps failing.

An Ant BuildException has occured: could not change remote directory: 550 /myBadDir: The system cannot find the file specified.

Do you know how to instruct my maven build to don’t care about this Ant task error / or how to instruct Ant to don’t fail in the case of a missing directory?

Edit:
Peter’s solution works.
If you a problem like

[INFO] Error configuring: org.apache.maven.plugins:maven-antrun-plugin. Reason: java.lang.NoSuchMethodError: org.apache.tools.ant.util.FileUtils.close(Ljava/io/InputStream;)V

Just exclude ant from ant-contrib

<dependency>
    <groupId>ant-contrib</groupId>
    <artifactId>ant-contrib</artifactId>
    <version>${ant-contrib.ver}</version>
    <exclusions>
        <exclusion>
            <groupId>ant</groupId>
            <artifactId>ant</artifactId>
         </exclusion>
    </exclusions>
</dependency>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T15:22:33+00:00Added an answer on May 14, 2026 at 3:22 pm

    Perhaps you need to think more like Ant and less like Maven in this case.

    Here is one solution. Use the ant-contrib trycatch task. Here is an example pom.xml. Copy the code block to a file named pom.xml and run mvn validate to see it work.

    
    
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <groupId>com.stackoverflow.q2666794</groupId>
      <artifactId>trycatch</artifactId>
      <packaging>jar</packaging>
      <version>1.0-SNAPSHOT</version>
      <name>trycatch</name>
      <url>http://maven.apache.org</url>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <version>1.3</version>
            <executions>
              <execution>
                <id>trycatch</id>
                <phase>validate</phase>
                <configuration>
                  <tasks>
                    <taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
                    <trycatch>
                      <try>
                        <fail>Failing ftp task should go here</fail>
                      </try>
                      <catch>
                        <echo>See the error was caught and ignored</echo>
                      </catch>
                    </trycatch>
                  </tasks>
                </configuration>
                <goals>
                  <goal>run</goal>
                </goals>
              </execution>
            </executions>
            <dependencies>
              <dependency>
                <groupId>ant-contrib</groupId>
                <artifactId>ant-contrib</artifactId>
                <version>1.0b3</version>
                <exclusions>
                  <exclusion>
                    <artifactId>ant</artifactId>
                    <groupId>ant</groupId>
                  </exclusion>
                </exclusions>
              </dependency>
            </dependencies>
          </plugin>
        </plugins>
      </build>
    </project>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 382k
  • Answers 382k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Assuming you want a single instance of the COM component… May 14, 2026 at 10:36 pm
  • Editorial Team
    Editorial Team added an answer @cyberw0lf, check this link how to develop activex invisible component… May 14, 2026 at 10:36 pm
  • Editorial Team
    Editorial Team added an answer You appear to be missing quotes in a couple of… May 14, 2026 at 10:36 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.