Problem in separating eclipse runtime classpath

I am using eclipse neon,
Buildship 2.2 and gradle 4.4.

I have multiple projects. And interdependancy betweent projects is causing problem. I want to filter or avoid runtime dependencies which feature is there in buildship 2.2. Below is description:

E.g. I have project A. Which has project B and C in its eclipse classpath.

Project A needs guava-23 with selenium 3.8.1
where as project B and C requires Guava-19 and selenium 3.0.1.
When i try to run testcases it does not allow me, causing conflict between guava and selenium versions.

I tried to separate out dependancies as per the link. I tried giving

api project(A) but its giving me error as Could not find method api() for arguments project[modules:A] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

can you please help me with this.


I’m not sure I understand your problem. The runtime classpath separation in Buildship only kicks in when you run a Java application with Eclipse JDT (e.g., right-click on a main method > Run as > Java Application). On the other hand, your error message suggests that the problem is in your Gradle build. I believe, in your case the problem is in the build configuration. Does your problem happen when you run your build from the command line? Also, can please create an example project exhibiting the problem?