In a gradle multi-project configuration, when a project depends on several others who share different versions of same dependencies, all those versions are present in the classpath when running a test in eclipse (4.5.1 with buildship 1.0.5).
Then when running a test in eclipse, test classpath in project-tests project will include both log4j-1.2.14 and log4j-1.2.17. Obviously it leads to runtime issues dependending on which version comes first in classpath.
While when running tests with gradle test, only the younger version will show up (as I would expect).
A self-contained example using gradle-2.8 is available on https://github.com/Starch/idea_wrong_classpath (problem appears also on idea, hence the project name). Just launch ClasspathTest in project-tests.
Note that the classpath in project properties seems correct (project1 and project2 do not export their deps and project-tests have only log4j-1.2.17). But when I run a test both log4j versions are in classpath.
Indeed, gradle 2.5 fixes some classpath problems that made eclipse unable to compile code in some cases (because it would have used the version exported by a module instead of its own).
But here the problem occurs only when running tests, where several versions of the same modules come into the classpath. Although as I said, the dependencies seems to be correct in project properties:
I just found out what causes the problem. Buildship defines project dependencies inside the classpath container. Turns out if a project dependency is specified inside a classpath container then the isExported flag is ignored for runtime.
I have the latest version of Buildship Eclipse Plugin installed but I amd still facing the same issue. Junit-4.10 gets precedence over 4.12 and causes compiler error.