Settings.gradle is not visible from build2.gradle

I have a trouble with my multi-project. In some subprojects I am executing several *.gradle build files, like: build.gradle, buildMy.gradle, … The problem is that files with not default names, don’t see root settings.gradle file, so they don’t know the structure of multi-project.

Detailed: Currently my root project is having next structure of subprojects:

  subproject1  subproject2  …  subprojectN/subsubProj1  subprojectN/subsubProj2  

in my subprojectN/subsubProj2 I’m having file two build files: build.gradle and build2.gradle which has the same lines:

dependencies {
 compile project(':subprojectN/subsubProj1')

for build.gradle result is succesfull, while for build2.gradle project is not found. Error log: project with path ‘:subprojectN/subsubProj1’ couldn’t be found in root project ‘subsubProj2’

Aha, my trouble was partly fixed…

solution has been found! in settings.gradle, you should specify for your subprojects if the build file name is changed.

rootProject.children.each { project ->
  if ('subprojectN/subsubProj2')){
  project.buildFileName = "build2.gradle"

But the problem still stays if I’d like to launch several build gradle files…

Could you elaborate on why you have multiple build files per project with similar code? What exactly are you trying to achieve?