How to include Gradle subproject into composite build?

Viewed 297

I'm trying to use composite builds of Gradle (3.5) for the 1st time and I need to include a library which is a subproject of another project (both in Java):

> gradle projects
:projects

------------------------------------------------------------
Root project
------------------------------------------------------------

Root project 'projects'
+--- ...
+--- Project ':common'    <-- this is a library I need
+--- ...

Gradle documentation gives examples of single-module projects only but specifying the path to common directory directly (i.e. includeBuild '../../projects/common') is not an option as it ends up with expectable error:

FAILURE: Build failed with an exception.
...
* What went wrong:
A problem occurred evaluating project ':common'.
> Could not find method sourceSets() for arguments [build_9fu2oyxlwh2mr0i7k6l680fpz$_run_closure1@66e1cb67] on project ':common' of type org.gradle.api.Project.

Another supposedly appropriate feature is substitutions but I don't see how to apply it to my case. I also haven't seen any statements in documentation telling that such an including is not possible. Depending on the whole projects is not right also because it is quite heavy repo.

So the question is: How to declare a dependency on certain subproject in Gradle composite build?

0 Answers
Related