Uploaded image for project: 'Maven Dependency Plugin'
  1. Maven Dependency Plugin
  2. MDEP-442

Failed to access file due to locked access when using more than one Maven worker thread

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Critical
    • Resolution: Unresolved
    • Affects Version/s: 2.8
    • Fix Version/s: waiting-for-feedback
    • Component/s: copy
    • Labels:
      None
    • Environment:
      MVN 3.0.4, JDK 1.7, Win 7 Pro SP1 64 Bit

      Description

      My multi-module POM contains of ten modules. Each of that modules does the same: Invoke the 'copy' goal of the dependency plugin. The idea is to have ten copies of the identical source, which then will end up in ten different targets by getting furthere processed.

      As long as I do not use more than one Maven worker thread, everything works well always. But when using -T 5 to have five worker threads, rather often the reactor fails because the source file is locked:

      [ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.8:copy (copy) on project MYARTIFACT: Unable to resolve artifact. Could not transfer artifact mygroup:myartifact:dll:4.36.1-20140415.143537-37 from/to nexus (http://nexus/nexus/content/groups/public): C:\Users\jenkins.QUIPSY\.m2\repository\mygroup\myartifact\4.36.1-SNAPSHOT\myartifact-4.36.1-20140415.143537-37.dll (The process cannot access the file, because it is in use by another process)
      

      So it seems that the 'copy' task actually is locking the source file, which is not multi-threading-compatible. Hence, either that is a bug and should get fixed, or it is on purpose, then this goal has to be marked as non-multithreading-able.

        Attachments

        1. maven-thread-test.zip
          6 kB
          Laura Llewellyn
        2. maven-thread-test-update.zip
          6 kB
          Laura Llewellyn

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              mkarg Markus Karg
            • Votes:
              3 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated: