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

前端 未结 9 966
我寻月下人不归
我寻月下人不归 2020-12-18 19:01

I occasionally receive this error when I build my project with

>mvn --version
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602         


        
相关标签:
9条回答
  • 2020-12-18 19:35

    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.

    0 讨论(0)
  • 2020-12-18 19:35

    For me the reason for this was only being in said folder with my git bash while building. Ensure that you don't happen to have the said folder open in any other program.

    0 讨论(0)
  • 2020-12-18 19:38

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

    0 讨论(0)
  • 2020-12-18 19:41

    My issue was resolved when I gave mvn clean command from windows coammandprompt

    0 讨论(0)
  • 2020-12-18 19:44

    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.

    0 讨论(0)
  • 2020-12-18 19:52

    I had the exact same issue when trying to run the First Cup tutorial.

    I fixed it by simply closing NetBeans and running it as administrator (via right click).

    0 讨论(0)
提交回复
热议问题