"Directory creation was not successful for an unknown reason" error with Ant on Mac

8.5k Views Asked by At

I have a project that builds and works on Windows but when I've brought it over to MacOS (Sierra) and set up Resin, Ant, and the rest of my project in IntelliJ the build is failing with a fairly ambiguous error:

build.xml:24: Directory /java/ant-build/classes creation was not successful for an unknown reason

at org.apache.tools.ant.taskdefs.Mkdir.execute(Mkdir.java:70)

Image of the full error message

At first I thought it was a permissions issue but I ran chmod 755 on the two directories and still am getting this error. I also tried updating to a newer version of Ant to replace IntelliJ's built in one with brew install [email protected] but that didn't help either.

Does anyone know of any changes that need to be made to projects when migrating from Windows to Mac? I'm the first one at the company to migrate this project to Mac so unfortunately the others don't know much about this.

Both are using:

  • IntelliJ IDE 2017.1.2
  • Built in IntelliJ Ant (1.9.4)
  • Resin 4.0.51
2

There are 2 best solutions below

1
MLDimitry On BEST ANSWER

As the comments on the main post point out, this was a permissions issue where the ant was trying to build in the root directory

I had to change my build.properties file so the paths were point towards my $HOME directory.

0
Christian Kohlschütter On

This error surprisingly also occurs in some environments when trying to "mkdir" a path that is an existing symbolic link to another directory.

I've had this error in a GitHub action, but couldn't reproduce locally.

In my case, some Maven plugin wanted to mkdir src/main/java, but that was a symbolic link to another directory in the project.

My workaround was to declare another source directory for the symlinked code (using build-helper-maven-plugin) and leave src/main/java alone.