Gradle run task on root project only and no subproject

Now both rootProject and subproject are applying the same plugin “abc”.

In the plugin “abc”, there is a task called “taskA”.

If I want to run the taskA at the rootProject only, what should I do?

Now it will runt the taskA at rootProject and then continue to run on all the subprojects.

So how do i disable taskA in subProject ?

instead of triggering ‘taskA’ call ‘:taskA’ to execute the task of the root project only

Thanks.

Another questions, if I have many subprojects and I want to avoid one of them not to run taskA.

any alternatives so that all run taskA except the specific one subproject.

you can exclude tasks using ‘-x’. e.g you can run “gradle taskA -x subprojC:taskA”

And exist any way how to do it without control from command line?

Ideally I want to hide all task from one subproject and define only one own that will be able to run original tasks.

If by hide you mean that they won’t show up in ‘gradle tasks’, declaring a task that depends on all other tasks will have that effect. If you mean that they can’t be run from the command line, there is no direct way to achieve this.