mirror of
https://github.com/google/nomulus.git
synced 2025-04-30 03:57:51 +02:00
Force Gradle to use jre version of Guava (#271)
* Force Gradle to use jre version of Guava Guava is often specified by version only by other dependencies. In such cases, Gradle usually resolves it to the '-android' version, which lacks the collection classes. We use custom resolution strategy to force the selection of the '-jre' version.
This commit is contained in:
parent
005e059d33
commit
f1360285d6
1 changed files with 14 additions and 0 deletions
|
@ -28,6 +28,20 @@ tasks.test.dependsOn tasks.checkstyleTest
|
||||||
// TODO(weiminyu): investigate incremental coverage change calculation and alert.
|
// TODO(weiminyu): investigate incremental coverage change calculation and alert.
|
||||||
tasks.test.finalizedBy jacocoTestReport
|
tasks.test.finalizedBy jacocoTestReport
|
||||||
|
|
||||||
|
configurations.all {
|
||||||
|
// Guava as a transitive dependency is also referred to by version only,
|
||||||
|
// without suffix. In such cases, Gradle resolves it to ${version}-android,
|
||||||
|
// which lacks the collection classes. We use custom strategy to force the
|
||||||
|
// selection of '-jre' jar.
|
||||||
|
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
|
||||||
|
if (details.requested.group == 'com.google.guava'
|
||||||
|
&& details.requested.name == 'guava'
|
||||||
|
&& details.requested.version.endsWith('-android')) {
|
||||||
|
details.useVersion details.requested.version.replace('-android', '-jre')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
// compatibility with Java 8
|
// compatibility with Java 8
|
||||||
errorproneJavac("com.google.errorprone:javac:9+181-r4173-1")
|
errorproneJavac("com.google.errorprone:javac:9+181-r4173-1")
|
||||||
|
|
Loading…
Add table
Reference in a new issue