Is it possible for Gradle projects in Eclipse/STS to resolve dependencies to other Gradle projects in the same workspace?
Asked Answered
Z

2

7

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 installed 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?

Zoologist answered 9/10, 2014 at 16:3 Comment(1)
possible duplicate of Eclipse gradle and maven tooling - local resolutionZoologist
Z
6

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

Zoologist answered 9/10, 2014 at 18:7 Comment(2)
Actually I am working on that since yesterday. If all goes well it should be available in a snapshot build in the not too distant future. Just keep an eye out on the Jira issue linked above. I'll post some info when its done.Topee
Where can I find documentation for this "Gradle IDE"?Germanize
L
0

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.

Loy answered 9/10, 2014 at 17:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.