Detect and prevent configuration that triggers a Gradle bug (#31912)
* Detect and prevent configuration that triggers a Gradle bug As we found in #31862, this can lead to a lot of wasted time as it's not immediatly obvius what's going on. Givent how many projects we have it's getting increasingly easier to run into gradle/gradle#847.
This commit is contained in:
parent
aae0133847
commit
38e2e1d553
17
build.gradle
17
build.gradle
|
@ -222,7 +222,7 @@ subprojects {
|
|||
"org.elasticsearch.gradle:build-tools:${version}": ':build-tools',
|
||||
"org.elasticsearch:rest-api-spec:${version}": ':rest-api-spec',
|
||||
"org.elasticsearch:elasticsearch:${version}": ':server',
|
||||
"org.elasticsearch:elasticsearch-cli:${version}": ':libs:cli',
|
||||
"org.elasticsearch:elasticsearch-cli:${version}": ':libs:elasticsearch-cli',
|
||||
"org.elasticsearch:elasticsearch-core:${version}": ':libs:core',
|
||||
"org.elasticsearch:elasticsearch-nio:${version}": ':libs:nio',
|
||||
"org.elasticsearch:elasticsearch-x-content:${version}": ':libs:x-content',
|
||||
|
@ -622,6 +622,21 @@ gradle.projectsEvaluated {
|
|||
}
|
||||
}
|
||||
}
|
||||
// Having the same group and name for distinct projects causes Gradle to consider them equal when resolving
|
||||
// dependencies leading to hard to debug failures. Run a check across all project to prevent this from happening.
|
||||
// see: https://github.com/gradle/gradle/issues/847
|
||||
Map coordsToProject = [:]
|
||||
project.allprojects.forEach { p ->
|
||||
String coords = "${p.group}:${p.name}"
|
||||
if (false == coordsToProject.putIfAbsent(coords, p)) {
|
||||
throw new GradleException(
|
||||
"Detected that two projects: ${p.path} and ${coordsToProject[coords].path} " +
|
||||
"have the same name and group: ${coords}. " +
|
||||
"This doesn't currently work correctly in Gradle, see: " +
|
||||
"https://github.com/gradle/gradle/issues/847"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (System.properties.get("build.compare") != null) {
|
||||
|
|
|
@ -25,6 +25,8 @@ apply plugin: 'elasticsearch.build'
|
|||
targetCompatibility = JavaVersion.VERSION_1_7
|
||||
sourceCompatibility = JavaVersion.VERSION_1_7
|
||||
|
||||
group = "${group}.client.test"
|
||||
|
||||
dependencies {
|
||||
compile "org.apache.httpcomponents:httpcore:${versions.httpcore}"
|
||||
compile "com.carrotsearch.randomizedtesting:randomizedtesting-runner:${versions.randomizedrunner}"
|
||||
|
|
|
@ -24,16 +24,6 @@ apply plugin: 'nebula.optional-base'
|
|||
apply plugin: 'nebula.maven-base-publish'
|
||||
apply plugin: 'nebula.maven-scm'
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
nebula {
|
||||
artifactId 'elasticsearch-cli'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
archivesBaseName = 'elasticsearch-cli'
|
||||
|
||||
dependencies {
|
||||
compile 'net.sf.jopt-simple:jopt-simple:5.0.2'
|
||||
compile "org.elasticsearch:elasticsearch-core:${version}"
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
group = "${group}.plugins.discovery-ec2.qa"
|
|
@ -0,0 +1 @@
|
|||
group = "${group}.plugins.repository-azure.qa"
|
|
@ -0,0 +1 @@
|
|||
group = "${group}.plugins.repository-gcs.qa"
|
|
@ -131,3 +131,5 @@ if (extraProjects.exists()) {
|
|||
|
||||
// enable in preparation for Gradle 5.0
|
||||
enableFeaturePreview('STABLE_PUBLISHING')
|
||||
|
||||
project(":libs:cli").name = 'elasticsearch-cli'
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
group = "${group}.x-pack.qa.rolling-upgrade.with-system-key"
|
|
@ -0,0 +1 @@
|
|||
group = "${group}.x-pack.qa.rolling-upgrade.without-system-key"
|
|
@ -4,6 +4,8 @@ dependencies {
|
|||
|
||||
Project mainProject = project
|
||||
|
||||
group = "${group}.x-pack.qa.sql.security"
|
||||
|
||||
subprojects {
|
||||
// Use resources from the parent project in subprojects
|
||||
sourceSets {
|
||||
|
|
Loading…
Reference in New Issue