Forcing all Java code to compile with groovyc

It appears the groovy plugin delegates any *.java files to the java compiler even though I explicitly do

sourceSets {
    main{
        java {
            srcDirs = []
        }
        groovy {
            srcDirs += ['src/main/java']
        }
    }

I want to use groovyc so that the metaclass is added for later testing reasons.

Is there anyway to get the groovy plugin to treat all java classes as groovy classes when compiling?

Not without renaming them to .groovy.

Gradle leverages Groovy’s joint compilation support which by default delegates compilation of all Java sources to javac. There’s currently no option for changing this behavior.

Thanks Mark, that is what I suspected but figured it was good to get a confirmation.