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 315065
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T08:15:26+00:00 2026-05-12T08:15:26+00:00

I am trying to deploy a Maven site to an FTP server. I am

  • 0

I am trying to deploy a Maven site to an FTP server. I am using the following code in my pom.xml:

<plugin>
 <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-antrun-plugin</artifactId>
<executions>
    <execution>
    <id>ftp</id>
    <phase>post-site</phase>
    <configuration>
        <tasks>
            <ftp action="del" server="nexus"
        remotedir="/pub/${project.groupId}/${project.artifactId}"
        userid="anonymous" password="my.name@gmail.com"
        skipFailedTransfers="true" ignoreNoncriticalErrors="true">
        <fileset>
                <include name="**/" />
        </fileset>
            </ftp>
        <ftp action="rmdir" server="nexus"
             remotedir="/pub/${project.groupId}/${project.artifactId}"
        userid="anonymous" password="my.name@gmail.com"
        skipFailedTransfers="true" ignoreNoncriticalErrors="true">
             <fileset>
            <include name="**/" />
             </fileset>
        </ftp>
        <ftp action="mkdir" server="nexus"
        remotedir="/pub/${project.groupId}/${project.artifactId}"
        userid="anonymous" password="my.name@gmail.com" depends="yes"
        verbose="no" chmod="777">
        </ftp>
    </tasks>
     </configuration>
     <goals>
    <goal>run</goal>
     </goals>
      </execution>
 </executions>
 </plugin>

Here I delete the previous site deployed, and creating a new directory for the site in the post-site phase, so that the deploy will have the structure it needs.
The problem is that it doesn’t work for the first time – when folder to delete does not exist. In the first time I must manually create the directory so it will work.
after the first time it works well.

my question is how do I check the existence of the directory before trying to delete it.

Thanks,
Ronen.

  • 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-12T08:15:27+00:00Added an answer on May 12, 2026 at 8:15 am

    You could do ftp mkdir first before the ftp del task is called, this would ensure the directory exists before deleting it. though of course that might fail if the directory already exists. I’m not able to test this, but according to the docs, adding ignoreNoncriticalErrors=”true” might let mkdir not fail if the directory exists.

    For example:

    <ftp action="mkdir"
      server="nexus"
      userid="anonymous"
      password="my.name@gmail.com"
      remotedir="/pub/${project.groupId}/${project.artifactId}"
      ignoreNoncriticalErrors="true"/>
    

    Update: From http://Ftp.java it looks like this will work:

    /**
     * Create the specified directory on the remote host.
     *
     * @param ftp The FTP client connection
     * @param dir The directory to create (format must be correct for host
     *      type)
     * @throws IOException  in unknown circumstances
     * @throws BuildException if ignoreNoncriticalErrors has not been set to true
     *         and a directory could not be created, for instance because it was
     *         already existing. Precisely, the codes 521, 550 and 553 will trigger
     *         a BuildException
     */
    protected void makeRemoteDir(FTPClient ftp, String dir)
        throws IOException, BuildException {
        ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to deploy and run my webapplication using maven and its tomcat
Hi I am trying to deploy an application using webstart. I have a requirement
I'm trying to deploy to a slicehost slice using this config/deploy/production.rb file. I'm clueless
I seemed to get the following exception when trying to deploy my application: Caused
In IIS 6, I am trying to deploy a Web Site project from Visual
Im using Eclipse 3.4, EclipseMe 1.7.9. Im trying to deploy/create package a simple project
I'm trying to understand the maven-release-plugin (version 2.0, CVS). The release-prepare works well. But
I'm trying to configure pom.xml so that it automatically deploys EAR archive to GlassFish
I am trying to remotely deploy a war file to a websphere application server.
I'm trying to use a custom maven wagon extension to deploy a jar to

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.