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

  • Home
  • SEARCH
  • 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 7517741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:32:46+00:00 2026-05-30T01:32:46+00:00

The ANT build script I have does the following: Perform the builds on Windows

  • 0

The ANT build script I have does the following:

  1. Perform the builds on Windows server & Zip the binaries
  2. Map a network drive with different credentials to a local drive (ex P:) using net use
  3. I am using <mkdir> to create a directory on the mounted drive (P:)
  4. Copy the binaries to that drive

Below is my code for mkdir

<echo>Creating ${buildRequesterUserId} folder at mirroring site starts</echo>
<mkdir dir="P:\build_output\${buildRequesterUserId}"/>
<echo>Creating ${buildRequesterUserId} folder at mirroring site ends</echo>

Some time the creation of folder works and some time it fails with below error

creation was not successful for an unknown reason and makes the build fail

This error happens randomly. The Mkdir works some time. I am not sure why it fails and not sure if its because of network lag

also the directory i am trying to create may or may not exist already. I read that the mkdir does not do anything if directory exists already

I checked and there is no failonerror for mkdir. I don’t want the build to fail because of this.

I have handled the error in copy part but not sure how to handle this mkdir

How can I achieve this? Any help would be appreciated

Regards

Karthik

  • 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-30T01:32:48+00:00Added an answer on May 30, 2026 at 1:32 am

    Apache Ant Mkdir task is calling File.mkdirs() method which is vulnerable to race conditions.

    File.mkdirs() is not an atomic operation – I guess it is implemented as a sequence of mkdir calls.

    In case of a remote filsystem there’s a good chance that your host gets aware of filesystem changes in the middle of File.mkdirs() operation and it fails.

    Ant seemed to try to fix it as Mkdir code changed from this in 1.8.0

    boolean result = mkdirs(dir);
    if (!result) {
      String msg = "Directory " + dir.getAbsolutePath()
             + " creation was not successful for an unknown reason";
      throw new BuildException(msg, getLocation());
    }
    

    to this in 1.8.2

    boolean result = mkdirs(dir);
    if (!result) {
      if (dir.exists()) {
        log("A different process or task has already created "
             + "dir " + dir.getAbsolutePath(),
             Project.MSG_VERBOSE);
        return;
      }
      String msg = "Directory " + dir.getAbsolutePath()
             + " creation was not successful for an unknown reason";
      throw new BuildException(msg, getLocation());
    }
    

    so maybe upgrading to the latest Ant could help?

    If not – some brute force Mkdir task extension could be created with your own execute() method implementation.

    If not – Trycatch task from Ant Contrib will work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ant script that does a headless build using the following ant
I have an ant build script that errors out with the following message. javac
I have an ant build script that needs to pull files down from a
I have a Java project that I build using an Ant script. I am
Let's suppose I have a valid Ant build script which packs up and prepares
I have a ant build script that uses a build.properties file. There I have
I have an ant script which does lots of stuff but I have been
I have an ant script with the following header: <project name=Simple ActiveJDBC Example default=clean
I'm using an Ant build script to collate my Eclipse-based application for distribution. One
I've created a Java project from existing source with an Ant build script in

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.