Java test dependencies

Hello,

I’m using the Java plugin and when I print the runtimeClasspath of the test sourceset I get all the dependencies from my main sourceset, including jersey rest implementations, hibernate everything.

This is not what I want or expect. I’d expect only testCompile dependencies to be put in there.

This would also explain why the test runner takes so long to load.

Can anyone explain to me how those extra dependencies end up there and how to fix it?

Thanks

I just found out myself it’s because of dependency configuration inheritance. Test inherites from main.

Still trying to figure out how to do this differently though. Don’t need hibernate etc in my test, that’s for the integration-test sourceset.

There is a compileOnly configuration supplied by the java plugin.

A description of all the configurations as well as a diagram of their relationships can be found here.