maven-resources-plugin:2.5 - Cannot create resource output directory

On Windows, there reasons for being unable to create a folder are:

  1. Some other process is deleting this folder at the same time
  2. You don't have permissions to access this folder
  3. The folder is on a network share

Network shares are notoriously unreliable on Windows. Don't use them for any automated tasks. Always build projects with all files residing on a local hard disk.

If you use Maven and Eclipse to build at the same time, you should configure them to use different target folders. See https://stackoverflow.com/a/54366009/34088

Your POM should look like this:

<project>
  ...

  <build>
    <outputDirectory>${basedir}/${target.dir}/classes</outputDirectory>
    <testOutputDirectory>${basedir}/${target.dir}/test-classes</testOutputDirectory>
  </build>

  <properties>
    <target.dir>target</target.dir>
  </properties>

  <profiles>
    <profile>
      <id>eclipse-folders</id>
      <properties>
        <target.dir>target-eclipse</target.dir>
      </properties>
    </profile>
  </profiles>
  ...  

All that's left is to enable the profile eclipse-folders in the IDE.


Disable the automatic build of your IDE (Eclipse or IntellJ IDEA or whatever). It will conflict with the Maven build.


I experience this issue every time I run the command while I have the output folder or the parent folder opened in Windows Explorer.

If I move one level above the parent, the build ends successfully.

Tags:

Maven