It seems that you don’t fully understand the Gradle lifecycle.
doFirst {
compileTestJava.exclude("**/*abc*")
}
Here, you are “configuring” the compileTestJava
task in the “execution” phase. The compileTestJava
task has probably already executed by this stage so your configuration has no effect. See build phases.
I get the feeling you expect the compileTestJava
task to run twice for a single build. A task will either run once or not at all for each gradle execution.