Edward Edward - 3 months ago 73x
Java Question

How to set an encoding for the JavaDoc in gradle?

I have written Java-Classes with JavaDoc-commands that contain special characters like

. I generate the JavaDoc using a gradle build-file:

apply plugin: 'java'

and the in the commandline:
gradle javadoc

The encoding of the original files is UTF-8. The encoding of the JavaDoc files is also UTF-8. But there is no hint in the HTML-sources, that the files are UTF-8. Thats why my browser always thinks it is

How can I tell javadoc (via gradle) to also add
<meta charset="utf-8"/>
to the source codes, when generating the JavaDoc?


You'll want to set the javadoc charset option.

javadoc {
    options.charSet = 'UTF-8'