There seems to be open issue in Gradle for it:
https://github.com/gradle/gradle/issues/20854
>Monday, March 4, 2024 9:44 PM UTC from Pavel Pozdeev
>
>
>Hi team,
>I'm a new member, just joined the community. Trying to add Kraft support to
>some existing unit-tests.
>I noticed, that when I do any change to some unit-test, e.g.
>"kafka.admin.AclCommandTest.scala", and then run:
>
>"./gradlew core:compileTestScala"
>
>the entire folder "core/build/classes/scala/test" is cleared, and gradle
>re-compiles ALL tests. It takes quite a long time.
>Looks like this issue affects only tests. If I change main scala code, e.g.
>"kafka.admin.AclCommand.scala", and then run:
>
>"./gradlew core:compileScala"
>
>only single file is re-compiled, and it takes only a few seconds.
>Has anybody noticed same issue before?
>
>Best,
>Pavel Pozdeev