testCompile dependencies not being picked up if "up-to-date" (1.7 & 1.8)

we put the source and dependencies in build.gradle files in each package (following a previous convention for source code) “gradle clean test” works fine but if i do “gradle test” again it fails saying it cannot find the external library dependency i can workaround this failure by adding testRuntime at the root build.gradle file but this should not be a requirement

i think this failure occurs because the test compile is up-to-date such that the dependencies are not added from the package build.gradle prior to running the test this should not be the case, they should be added as documentation states:


The dependencies required to run the tests. By default, also includes the compile, runtime and test compile dependencies.

Can you provide a self-contained reproducible example? Chances are that something is wrong with your build script(s).

sent zip file via email to you

by the way, the problem did not occur until i defined buildDir in the base build.gradle should be a good hint

Each project needs to have its own build output directory. Also, it’s not common to put ‘build.gradle’ into the source tree, although it might work out fine.