From 53f7c918e4f8aaa6745a534bc14d264bdca28418 Mon Sep 17 00:00:00 2001 From: Sergey Matvienko Date: Mon, 16 Mar 2026 11:02:34 +0100 Subject: [PATCH] Fix Gradle parallel build cache contention in Maven -T builds When Maven runs with -T N, all modules using the packaging profile invoke gradle-maven-plugin against the same gradleProjectDirectory (packaging/java or packaging/js), causing them to share and contend on the same .gradle/ project cache directory simultaneously. Two fixes: - Pass --project-cache-dir pointing to each module's own target/.gradle, fully isolating parallel Gradle invocations from each other. - Add maven-clean-plugin filesets to remove packaging/java/.gradle and packaging/js/.gradle on mvn clean. Gradle always writes project-level metadata to the project directory regardless of --project-cache-dir, so these would otherwise accumulate on CI agents with persistent home directories. --- pom.xml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pom.xml b/pom.xml index bc83721914..5dcb3f7a77 100755 --- a/pom.xml +++ b/pom.xml @@ -532,6 +532,8 @@ -PpkgInstallFolder=${pkg.installFolder} -PpkgCopyInstallScripts=${pkg.copyInstallScripts} -PpkgLogFolder=${pkg.unixLogFolder} + --project-cache-dir + ${project.build.directory}/.gradle --warning-mode all @@ -888,6 +890,21 @@ com.mycila license-maven-plugin + + org.apache.maven.plugins + maven-clean-plugin + false + + + + ${main.dir}/packaging/java/.gradle + + + ${main.dir}/packaging/js/.gradle + + + +