You are viewing...

Fixing Gradle Javadoc task failure when using Java Modules

Updated on October 20, 2020 at the 08th hour
Posted under:

DISCLAIMER: Expressed views on this blog are my own.

You may be familiar with this shitty error probably using Gradle 6.7:

Caused by: java.lang.ClassCastException: class java.lang.String cannot be cast to class java.util.List (java.lang.String and java.util.List are in module java.base of loader 'bootstrap')

You likely have this in your afterEvaluate block:

javadoc {
  inputs.property("moduleName", moduleName)
  doFirst {
    options.addStringOption('-module-path', classpath.asPath)
  }
}

You can fix it with:

javadoc {
inputs.property("moduleName", moduleName)
options.modulePath = classpath.asList()
}
You just read "Fixing Gradle Javadoc task failure when using Java Modules". Please share if you liked it!
You can read more recent posts here.