I'm looking into migrating some of our ancient maven projects over to gradle (so shiny). Things are looking pretty good however I'm unable to get Eclipse/Gradle to adjust the project dependencies appropriately when I have 2 projects checked out. I'm hoping to use a repo for standard jar dependencies but be able to depend directly on a project if it is checked out.
Let's say ProjectB depends on ProjectA. As far as I understand the Eclipse/Maven plugin, it is able to a:
- Interrogate the maven dependency for ProjectA and understand its group/artifact/version tuple.
- Look through ProjectA eclipse project (if imported) to see if has the same group/artifact/version.
- Replace the jar dependency with a project dependency.
This is a powerful feature because it means that a developer does not need to import ProjectA when they are working on ProjectB -- they just get it from the repo. But if they do have it imported, they can make a refactor to ProjectA in Eclipse and it will automagically refactor the dependent code in ProjectB.
How can I get eclipse/gradle to adjust the build-path so that there is a project dependency when available otherwise use the jar?
Things I've looked into:
- Gradle "multi-projects" but our code isn't in a hierarchy like that.
- Gradle
includeFlat
but this isn't some simple single directory structure. - resolutionStrategy.dependencySubstitution but I couldn't seem to get it to work. I doubt that
findProject(...)
is able to find a project that is loaded into Eclipse to it can link the 2 projects together in the classpath. - composite builds seem to use some of the language I'm looking for but it is about importing a build into another build.
Anyone else figured this out? Thanks much in advance.