0

I recently upgraded the Maven Dependency Plugin from 3.3.0 to 3.4.0, and now my build fails during the unpack phase with the following error:

Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:3.4.0:unpack (unpack-dependencies) on project my-project: Error unpacking file: <file-path> Text file busy

Observations:

  • The error occurs when multiple threads or builds try to access the same file concurrently.
  • The goal is executed during the generate-test-resources phase, and the unpacked files are used immediately in later phases.
  • Downgrading back to 3.3.0 resolves the issue.

Question:

  • Has anyone encountered this "Text file busy" issue with Maven Dependency Plugin 3.4.0?
  • Is there a known workaround for safely unpacking dependencies in parallel builds without hitting this error?

Example Configuration:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    <version>3.4.0</version>
    <executions>
        <execution>
            <id>unpack-dependencies</id>
            <phase>generate-test-resources</phase>
            <goals>
                <goal>unpack</goal>
            </goals>
            <configuration>
                <artifactItems>
                    <artifactItem>
                        <groupId>com.example</groupId>
                        <artifactId>my-artifact</artifactId>
                        <version>1.0.0</version>
                        <classifier>linux</classifier>
                        <type>zip</type>
                        <outputDirectory>${project.build.directory}/libs</outputDirectory>
                    </artifactItem>
                </artifactItems>
            </configuration>
        </execution>
    </executions>
</plugin>
14
  • Have you tried with the last version plugin? mvnrepository.com/artifact/org.apache.maven.plugins/… Commented Nov 14 at 9:15
  • I've tried using the latest version of the plugin, but that introduces another issue. I'm attempting to unpack ChromeDriver, but occasionally, in some threads, I encounter SessionNotCreatedException. That's why I'm upgrading incrementally - to determine whether regressions were introduced in earlier versions. Commented Nov 14 at 9:42
  • Based on The goal is executed during the generate-test-resources phase, and the unpacked files are used immediately in later phases. the later phase runs in sequence not parallel... only in such cases where the usage is done in a separate module/sub-project within a parallelized build this can happen which would imply having wrong/missing dependencies given... also would it be helpful to see the full log output, Maven version and the full pom file etc. and how you called Maven ? Which JDK etc. would also very helpful.... Commented Nov 14 at 15:27
  • Thanks for your feedback! You’re right - if everything runs sequentially within a single module, this issue shouldn’t occur. In my setup, I have multiple threads running in parallel, and they share the same unpack output directory. That’s why I’m seeing the “Text file busy” error: one module starts using the unpacked binary while another is still trying to unpack (overwrite) it. Commented Nov 14 at 18:56
  • What’s puzzling is that this only started happening after upgrading maven-dependency-plugin from 3.3.0 to 3.4.0. I couldn’t find any release notes explaining this change, so I’m reaching out to see if anyone has more details or context on what changed between these versions. For reference, I’m using Maven 3.8.8 and JDK 17. Commented Nov 14 at 18:56

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.