I am converting a Java project from Ant to Gradle. The IDE of choice for our team is Eclipse. I have installed the Spring Gradle plugin for Eclipse, applied the Gradle project nature and enabled dependency management. The result is some compilation errors.

The compilation errors occur because the Gradle dependency container is before the JRE container in the eclipse classpath. Some jars on the classpath contain classes that should come from rt.jar (and they are incompatible with our code, presumably older versions).

When dependency management is disabled gradle dependencies come after the JRE container and it compiles without error. This is also consistent with my use of Eclipse/Maven/m2e where the the Maven dependency container comes after the JRE container in eclipse.

Is this the default behaviour for the plugin (putting the gradle container before the JRE)? Is there a way to change it?

I tried to do it in my build.gradle using the eclipse hooks (whenMerged and withXml) but these seem to execute before the gradle dependencies are replaced with the container entry.