diff --git a/build.gradle b/build.gradle index c1f5c9dcd1..d7db6ebed9 100644 --- a/build.gradle +++ b/build.gradle @@ -221,11 +221,20 @@ subprojects { // Define a separate configuration for managing the dependency on Jetty ALPN agent. configurations { alpnagent + + compile { + // Detect Maven Enforcer's dependencyConvergence failures. We only + // care for artifacts used as libraries by others. + if (!(project.name in ['grpc-benchmarks', 'grpc-interop-testing'])) { + resolutionStrategy.failOnVersionConflict() + } + } } dependencies { testCompile libraries.junit, - libraries.mockito + libraries.mockito, + libraries.truth // Configuration for modules that use Jetty ALPN agent alpnagent libraries.jetty_alpn_agent diff --git a/core/build.gradle b/core/build.gradle index 450f0badbf..81ceffffd7 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -4,9 +4,19 @@ dependencies { compile project(':grpc-context'), libraries.guava, libraries.errorprone, - libraries.jsr305, - libraries.instrumentation_api, - libraries.opencensus_api + libraries.jsr305 + compile (libraries.instrumentation_api) { + // prefer 2.0.19 from libraries instead of 2.0.11 + exclude group: 'com.google.errorprone', module: 'error_prone_annotations' + // we'll always be more up-to-date + exclude group: 'io.grpc', module: 'grpc-context' + } + compile (libraries.opencensus_api) { + // prefer 2.0.19 from libraries instead of 2.0.11 + exclude group: 'com.google.errorprone', module: 'error_prone_annotations' + // we'll always be more up-to-date + exclude group: 'io.grpc', module: 'grpc-context' + } testCompile project(':grpc-testing') diff --git a/interop-testing/build.gradle b/interop-testing/build.gradle index 24e0096ece..d3648f31ed 100644 --- a/interop-testing/build.gradle +++ b/interop-testing/build.gradle @@ -24,7 +24,8 @@ dependencies { libraries.junit, libraries.mockito, libraries.netty_tcnative, - libraries.oauth_client + libraries.oauth_client, + libraries.truth } configureProtoCompilation() diff --git a/protobuf/build.gradle b/protobuf/build.gradle index 10d445dbdd..c637fa022d 100644 --- a/protobuf/build.gradle +++ b/protobuf/build.gradle @@ -19,6 +19,8 @@ dependencies { // 'com.google.api:api-common' transitively depends on auto-value, which breaks our // annotations. exclude group: 'com.google.api', module: 'api-common' + // Prefer our more up-to-date protobuf over 3.2.0 + exclude group: 'com.google.protobuf', module: 'protobuf-java' } compile (project(':grpc-protobuf-lite')) { diff --git a/testing/build.gradle b/testing/build.gradle index 2ebc78fa26..efb942d4d2 100644 --- a/testing/build.gradle +++ b/testing/build.gradle @@ -3,9 +3,18 @@ description = "gRPC: Testing" dependencies { compile project(':grpc-core'), project(':grpc-stub'), - libraries.junit, - libraries.mockito, - libraries.truth + libraries.junit + compile (libraries.mockito) { + // prefer 1.3 from JUnit instead of 1.1 + exclude group: 'org.hamcrest', module: 'hamcrest-core' + } + // Use compileOnly to avoid dependencyConvergence problem with the Guava + // pulled in via Truth, for users that don't use Truth. Truth requires a + // more up-to-date Guava than we support elsewhere, which would trigger + // convergence failures in tests that only our users could resolve. Using + // compileOnly means only users using Truth would have the problem and + // they'd have to resolve it like normal anyway. + compileOnly libraries.truth testCompile project(':grpc-testing-proto') }