Run tasks under specified subprojects in parallel

I’m working on the nested multi-projects as follows.

root
├── pjA
│   ├── pjA1
│   └── pjA2
├── pjB
│   ├── pjB1
│   └── pjB2
└── pjC
     ├── pjC1
     └── pjC2

To run build tasks under specified subprojects, we will run the following commands. This builds pjA, pjB and all their subprojects (A1, A2, B1, B2).

./gradlew build -p pjA
./gradlew build -p pjB

I realized this takes much time, so decided to turn into a single command and use parallelism. Firstly I tried the following command.

./gradlew pjA:build pjB:build

But this does not build any subprojects of pjA and B. To do that, so I had to run this much longer command.

./gradlew pjA:build pjA:pjA1:build pjA:pjA2:build pjB:build pjB:pjB1:build pjB:pjB2:build 

This is not convenient and changes must be made each time any subproject is added or removed.
If I could use -p option more than once, I simply could write it this way…

./gradlew build -p pjA -p pjB

Is there any good solution?

If for example pjB depends on pjB1 and pjB2, you could use pjB:buildNeeded instead.