Skip to content

Commit 495a987

Browse files
committed
Fix Gradle 4.3.1 compatibility for logging (#27382)
The build currently does not work with Gradle 4.3.1 as the Gradle team stopped publishing the gradle-logging dependency to jcenter, starting with 4.3.1 (not sure why). There are two options: - Add the repository managed by Gradle team (https://repo.gradle.org/gradle/libs-releases-local) to our build - Use an older version (4.3) of the dependency when running with Gradle 4.3.1. Not to depend on another external repo, I've chosen solution 2. Note that this solution could break on future versions, but as this is a compileOnly dependency, and the interface we use has been super stable since forever, I don't envision this to be an issue (and easily detected by a breaking build).
1 parent 4e9828b commit 495a987

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

buildSrc/build.gradle

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
import java.nio.file.Files
2121

22+
import org.gradle.util.GradleVersion
23+
2224
apply plugin: 'groovy'
2325

2426
group = 'org.elasticsearch.gradle'
@@ -99,9 +101,11 @@ dependencies {
99101

100102
// Gradle 2.14+ removed ProgressLogger(-Factory) classes from the public APIs
101103
// Use logging dependency instead
104+
// Gradle 4.3.1 stopped releasing the logging jars to jcenter, just use the last available one
105+
GradleVersion logVersion = GradleVersion.current() > GradleVersion.version('4.3') ? GradleVersion.version('4.3') : GradleVersion.current()
102106

103107
dependencies {
104-
compileOnly "org.gradle:gradle-logging:${GradleVersion.current().getVersion()}"
108+
compileOnly "org.gradle:gradle-logging:${logVersion.getVersion()}"
105109
compile 'ru.vyarus:gradle-animalsniffer-plugin:1.2.0' // Gradle 2.14 requires a version > 1.0.1
106110
}
107111

0 commit comments

Comments
 (0)