Can gradle ignore sub project build.gradle or sub project buildscript configurations?

I have a multi project setup, where each subproject are also buildable on it’s own using it’s own build.gradle. When participating in the multiproject setup, I’d like the local build.gradle to be superceded by the root project build.gradle and it’s declarations. Specifically, I’d like the root declaration of buildscript dependencies to be the master, and therefore I’ve done like this in the sub projects:

if (!project.rootProject.has(“multiproject”)){

buildscript{

This doesn’t work: “You can’t change a configuration which is not in unresolved state!”

I even tried this in the sub project build file

if (true){

buildscript{

but simply adding this condition breaks the build with the same error as above!

What can I do to make gradle ignore the sub project buildscript blocks without breaking my standalone build?

Instead of putting the ‘buildscript {…}’ block itself in a conditional, simply place the conditional inside the ‘buildscript {…}’ block around any configuration you might have.

buildscript {

if (true) {

// configuration

}

}