Exclude a class depedency in compile, but include in testCompile for gradle <p>I'm having an issue where I have an old version of library Foo as a transitive dependency in one of my included libs. I want to use a newer version of library Foo in my testCompile, but it's causing a conflict when I run tests in intelliJ, as intelliJ is defaulting to using the older Foo lib.</p> <p>I've tried excluding Foo, and then explicitly including it in testCompile, but it seems the exclude overrides the include in testCompile. </p> <p>I'm currently using the below to force a resolution, but I would prefer I don't force compile dependencies to a specific version. </p> <pre><code>configurations.all { resolutionStrategy { force 'org.foo:bar:1.0' } } </code></pre>