How to override version only for test compile and running tests

Hi @deanhiller,

If I understand correctly, you want to define a different Guava version in testing. Then you can set a constraint on testImplementation. Which will reflect in test compilation and runtime.

dependencies {
  constraints {
    testImplementation("com.google.guava:guava:16.0.1")
    // or if you need to force a version down, you can make it strict: 
    // testImplementation("com.google.guava:guava:16.0.1!!")
  }
}

This is documented in the Java Library plugin docs:
https://docs.gradle.org/current/userguide/java_library_plugin.html#sec:java_library_configurations_graph

There is no built-in task or something to show you all configurations.

1 Like