Using the new javaVersion property in groovydoc

Hi,

I am keen to use the new javaVersion property added to GroovyDoc in Groovy 4.0.27 but cannot figure it out. According to the gradle documentation, “The version of the Groovydoc that is used, is the one from the Groovy dependency defined in the build script.” so i did this:

add compileOnly "org.apache.groovy:groovy-ant:4.0.27" to dependencies

add a groovydoc config

groovydoc {
    javaVersion = 'JAVA_21'
}

But gradle is unhappy with this:

Could not set unknown property ‘javaVersion’ for task ‘:matrix-spreadsheet:groovydoc’ of type org.gradle.api.tasks.javadoc.Groovydoc.

Any pointers how to get this working would be most appreciated!

You are not trying to set the property on the Ant task where it was added.
You are trying to set the property on the Gradle task that under the hood uses the Ant task which you do not influence.
I don’t think there is a way to use this with the Gradle task unless the property was explicitly added.
You could at most use the Ant-integration and thus use the Ant task directly instead of the built-in Gradle task.

1 Like

OK thank you! I created an enhancement request here. Meanwhile, I’ll try the workaround you suggested.

1 Like