Browse Source

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.
pull/15248/head
Sergey Matvienko 3 months ago
parent
commit
53f7c918e4
  1. 17
      pom.xml

17
pom.xml

@ -532,6 +532,8 @@
<arg>-PpkgInstallFolder=${pkg.installFolder}</arg>
<arg>-PpkgCopyInstallScripts=${pkg.copyInstallScripts}</arg>
<arg>-PpkgLogFolder=${pkg.unixLogFolder}</arg>
<arg>--project-cache-dir</arg>
<arg>${project.build.directory}/.gradle</arg>
<arg>--warning-mode</arg>
<arg>all</arg>
</args>
@ -888,6 +890,21 @@
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<inherited>false</inherited>
<configuration>
<filesets>
<fileset>
<directory>${main.dir}/packaging/java/.gradle</directory>
</fileset>
<fileset>
<directory>${main.dir}/packaging/js/.gradle</directory>
</fileset>
</filesets>
</configuration>
</plugin>
</plugins>
</build>

Loading…
Cancel
Save