How do you add a Gradle Composite Build to the buildscript classpath

465 views Asked by At

I have included a sub-project using includeBuild in the settings.gradle file. I want to reference this project in the buildscript classpath. Both classpath project(":projectname") and classpath 'mygroup:subproject' in the build.gradle file but this does not seem to work. I tried explicit Dependency Substitutions for the latter case in settings.gradle file also with

  • includeBuild('subproject') { dependencySubstitution { substitute module('mygroup:subproject') with project(':') } },
  • includeBuild('subproject') { dependencySubstitution { substitute module('mygroup:subproject') with project(':subproject') } } and
  • includeBuild('subproject') { dependencySubstitution { substitute module('mygroup:subproject') with project('subproject') } }.

which did not work.

The projects are not published as they are new and coding is WIP hence cannot be built as yet.

1

There are 1 answers

0
sunwei On
includeBuild('subproject') {
    dependencySubstitution { 
        substitute module("mygroup:subproject") using(project(':'))
    } 
}