Using Spock with a java project

I’ve got a codebase with src/main/java, and tests written in spock (under src/test/groovy).
When I use the groovy plugin, it causes groovydoc to run and that is not happy with all the java 8 default methods in interfaces.

Is there a recommended way to have a java library with groovy tests such that it produces javadoc instead of groovydoc?

What do you mean by, “it causes groovydoc to run”?
I’ve used groovy/spock for tests and never had the groovydoc task automatically run. The groovydoc task only runs when I request it on the command line. Perhaps another plugin or a task dependency is causing the groovydoc task to be included in the task graph unexpectedly?

You could try disabling the task if you cannot get it removed from the task graph:

tasks.groovydoc.enabled = false

When I call ./gradlew build, it would attempt to generate javadoc using groovydoc.
Since my src/main/groovy is empty, it produced a nearly empty javadoc.jar.

I later figured out that it was the gradle-nexus-plugin that checked for the presence of a task called groovydoc and if it did, used its output to create a javadocJar if extraArchives.javadoc was set to true.

After I set that to false and created my own javadocJar task, it started working as I needed.