We are using gradle from another build tool to publish artifacts to artifactory by using the maven-publish plugin.
When calling many gradle instances in parallel they seem to override each other pom/jar and tries to publish some jar/pom multiple times and some jar/pom not at all.
It only seems to happen when the groupName matches for the pom/jar.
Simple configuration to reproduce:
apply plugin: 'java'
apply plugin: 'maven-publish'
publishing {
publications {
mavenJava(MavenPublication) {
groupId groupName
artifact file(artifactFilePath)
artifactId artifactName
version '001'
}}}
Script that executes gradle in parallel 9 times with 3 different groupNames.
#!/bin/bash
TOP=3
for ((i=1; i<=$TOP; i++))
do
for ((j=1; j<=$TOP; j++))
do
eval './gradlew publish -PartifactFilePath=empty.file -PgroupName=ciTest.subdir${i} -PartifactName=artifact${j}.file -s &'
done
done
I have tried the following flags without any luck:
-Dorg.gradle.daemon=false -Dorg.gradle.configureondemand=false -Dorg.gradle.parallel=false --project-cache-dir=/tmp/gradleCache/cache${i}${j}
One thing that helps is --recompile-scripts but that in turns makes the gradle publishing serial so I don’t know if it really fixes the issue or not.