Dependency Substitution Fails based on project name

We are trying to use the Dependency Substitution to replace jar dependencies with project deps, so that when multiple projects are open in an IDE they are linked as project deps, but when run from command line follow normal dep rules.

We do this by checking out all our modules into a folder then adding a top level build.gradle/settings.gradle files that just links them together and applies dep substitutions.

This was working great … but then we created a plugin that afterEvaluate goes through the list of dependencies for our projects and prints out some useful information for us (we are using SNAPSHOTs, so it prints out exactly what version was resolved)

The problem is that depending on the name (and hence ordering) of the modules this plugin causes resolution to fail. I’m guessing that because, before the substitution the projects didn’t depend on each other gradle just processes them in alpha order.

Attached is a couple of examples in both examples there is a module ‘b’ that depends in the jar of the other module, and uses dependency substation to replace it with a project dep … in the working folder the other module is called ‘a’ and in the failing folder the other module is called ‘c’

I’m guessing there are a couple of way to workaround this

  • disable my plugin if I can detect that we are doing this ‘IDE setup’ type build
  • is there potentially a later stage that I can attach the plugin to so the projects have figured out they are now linked (note that the plugin is defined in the child modules, which may or may not be child modules depending on if we are doing this IDE type setup)
  • Is this actually a bug? and there might be some way to fix it, rather than workaround it (109.2 KB)