How can I exclude certain subprojects in my multi-project gradle build. I want to exclude a apply plugin call by querying a property of the subproject.
The build.gradle of my parent project looks like this:
subprojects {
if (!ext.has('excludeProject')) {
apply plugin: 'org.example.DemoPlugin'
}
}
And the build.gradle of some subprobjects contain this:
ext {
excludeProject = true
}
This does not work. The plugin is always applied. I also tried different syntax like if(!project.ext.exclude) or if(!project.hasProperty('exclude')).
What works is: if I put a "gradle.properties" in the subproject and define the property there (excludeProject=true), then it works.
If I query "if(project.name != "subproject")that also works, but I dont want that solution. Is there a way to get it working by using extension properties in the build.gradle ?