Excluding Release build from all sub-projects?

I currently have a parent Gradle file that builds two other modules. Currently, if I want to exclude a Release build when building my parent Gradle file I have to add the following to my task:

task installToLocal(type:Exec) {
commandLine ‘cmd’, ‘/c’, ‘gradle assembleDebug & gradle installMavenLocal -x:test:packageRelease’
}

In order to exclude the Release build from test, I have to specify -x:test:packageRelease. Is there a way where I can just do something like -x:packageRelease and it will do it for all modules? If I were to add 10 other Gradle projects to the parent Gradle file, I want to avoid having to add a bunch of -x:otherProject:packageRelease to my task for each app.

The -x option excludes tasks similarly to how the task you specify to run are handled. If the task name is qualified, it refers to a specific task. If it’s unqualified it affects all tasks of that name in any project. See the user guide: executing a multi-project build for more details on that.

Running gradle assembleDebug installMavenLocal -x packageRelease``` should do exactly what you want. Your inclusion of the ':`’ is causing the behavior you don’t really want.