Nested submodule build issues with inter-project module dependencies

I was thinking about submitting an issue on gradle/gradle, but thought I’d ask here first.

I created a repo with a descriptive README about the issue here:

Essentially, depending on application jars from another module when using nested submodules fails to properly depend on the jar task (only when the nested hierarchy is deeper than one or two subdirs). This setup has created other issues as well such as building jars that have all class files but cause ClassNotFoundExceptions. I focused on re-creating one of the build errors with this repo.

The first commit is a simpler project structure that passes and the second commit is a broken build with a project hierarchy with a deeper nesting. The third commit fixes the build, but it requires manually depending on the jar task for every inter-project dependency (my project has about 30 of them so it gets very unwiedly and seems very un-gradley).

I’ve been using gradle for a decade and have never had this complex of a project – it’s a giant organization-wide mono-repo instead of having a couple of similarly grouped modules each in their own repo.

Any suggestions on what I can do with my build configuration to correctly resolve the second commit’s build or where I can start diving into the gradle source to find a cause are greatly appreciated!

service-code’s jar task now has input files that come from the runtimeClasspath configuration, however Gradle is not being told that they are inputs. If you add

jar {
    inputs.files( configurations.runtimeClasspath )
    ...
}

then Gradle will be aware of the input file collection (the configuration) and it will know how to “find the required task dependencies”.

The structure of the projects should not have changed this behaviour, so perhaps it was working by luck in some cases. I’ll admit, I didn’t look at any of the earlier commits, just the head revision, so maybe there’s something I’m missing.

Thanks for the help. After a decade of using gradle I’ve never had to explicitly specify runtime deps as jar inputs so that line of config is new to me.

Thanks!