A Gradle project in my workspace (call it Downstream) needs to depend on another Gradle project (call it Upstream). Outside of Eclipse, of course Upstream would need to be build and install
ed before Downstream (so that Gradle can resolve it). In Eclipse, since both projects are in the workspace together, I'd like to have Gradle look in the workspace first and make the dependency between the projects, not from the repo.
m2e (Maven integration for Eclipse) does this (the option is called Resolve dependencies from Workspace). Gradle Eclipse plugin has an option called Remap Jars to maven projects but that seems to do this for pom-driven m2e projects, not other Gradle projects.
Is there any way to get Gradle to resolve dependencies to the local workspace (when they're present) instead of the repo?
It turns out this is was an outstanding feature request for Gradle IDE. It has been delivered for the 3.6.3 release of Gradle IDE.
You do have to enable it, though:
The feature has to be enabled in the Gradle preferences page. Access
via "Window >> Preferences >> Gradle".
If you are not seeing the "remap jars to Gradle projects" there then
maybe double check that version of the Gradle plugins is indeed 3.6.3.
Maybe something went wrong during the upgrade and you are still using
an older version.
Source
As far as I know these is no such functionality in current STS plugin. Given that there is the re-mapping support to replace dependencies with reference to m2e project I think it should be possible to add it.
Modifying the generated classpath using XML hooks in EclipseClasspath
model descrideb in http://www.gradle.org/docs/current/dsl/org.gradle.plugins.ide.eclipse.model.EclipseClasspath.html will probably not help because this is done in Gradle process where you do not have information about existing Eclipse projects from your current workspace.