I tried in afterEvaluate …it is excluding for all the projects.
I will explain the scneario :
I had two projects: Root and Platform. Exclusion should happen for Platform.
At first platform got executed and exclusion was applied and it did not execute the task. Next Root got exected , but still the exclusion was there and it did not execute the task.
* Where:
Build file 'F:\XMS\xmsWorkspace.0.00\build.gradle' line: 46
* What went wrong:
A problem occurred configuring project ':PlatformDomain'.
> Failed to notify project evaluation listener.
> Cannot cast object '' with class 'java.lang.String' to class 'java.lang.Ite
rable'
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.
BUILD FAILED
‘getGradle().startParameter.excludedTaskNames’ always applies to all subprojects (after all it’s exactly the same as ‘-x’ on the command line). A good way to execute a task for a subset of projects is to only declare it for that subset of projects. Alternatively, you can set ‘someTask.enabled = false’.