Subprojects and multiple jars

Hello all,

I’m having several java project which are independently working fine but when I’m using git submodules and trying to build them as submodule I have some issues.

Let’s explain quickly the structure.
I have the following :

  • project A which generate :
    -> A_1.jar, (via standard jar task)
    -> A_1-sources.jar (via standard sourcesJar task)
    -> A_2.jar (from a custom task of type Jar which “dependsOn classes”)
    -> A_2-sources.jar (from a custom task of type Jar which “dependsOn classes”)
  • project B which generate :smile:
    -> B.jar, (via standard jar task)
    -> B-sources.jar (via standard sourcesJar task)

project B needs A_2.jar as a dependencies.

I do not explain the good (or not) reasons which lead to split into two jars files for project A. Let’s consider that’s a constraints.

So, when I compile project A on it’s own, it generates correctly all jars files. But when I used it onto a git meta-modules and build via submodule features, I only get A_1[…].jar files and not A_2’s one.

In the build.gradle of the meta-module I only declare the dependencies between the two projects, in the settings file I have declared the two projects with their path.

Thank you by advance for your help !