That was unexpected!
Using this plugin you can see the dependencies between tasks: https://plugins.gradle.org/plugin/com.dorongold.task-tree
When I ran it on my sample project I got the following for build:
:build
+--- :assemble
| \--- :jar
| \--- :classes
| +--- :compileGroovy
| | \--- :compileJava
| | \--- :compileKotlin
| +--- :compileJava
| | \--- :compileKotlin
| \--- :processResources
As you can see compileGroovy depends on compileJava and compileJava depends on compileKotlin.
What you can try is this:
./gradlew -m compileGroovy -x compileJava && ./gradlew -m compileJava -x compileGroovy
This will result in:
:compileGroovy SKIPPED
BUILD SUCCESSFUL
Total time: 0.63 secs
:compileKotlin SKIPPED
:compileJava SKIPPED
BUILD SUCCESSFUL
Total time: 0.639 secs
It’s so crazy that it just might work 