So i have a gradle based java project, with tons of hungarian docs string, witch mean a lot of non ASCII character.
It's perfectly fine since javac consume utf-8 characters in source code,and javadoc also should according to my knowledge.
In the build gradle has a task which create the java doc jar
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives sourcesJar
archives javadocJar
}
When i run gradle build
, it's fail with the following error:
:compileJava C:\Home\Projects\InventoryCore\src\main\java\hu\rfit\inventory\models\entities\ItemState.java:11: error: unmappable character for encoding Cp1252 * ├?ru / term├⌐k ├íllapot. ^ :processResources UP-TO-DATE :classes :jar :javadoc C:\Home\Projects\InventoryCore\src\main\java\hu\rfit\inventory\models\entities\ItemState.java:11: error: unmappable character for encoding Cp1252 * ├?ru / term├⌐k ├íllapot. ^ 1 error :javadoc FAILED
FAILURE: Build failed with an exception. What went wrong: Execution failed for task ':javadoc'. Javadoc generation failed. Generated Javadoc options file (useful for troubleshooting): 'C:\Home\Projects\InventoryCore\build\tmp\javadoc\javadoc.options'
The best part is it's running perfectly in build pipeline, and on my other os (ubuntu 16.04 lts) it's fail only on windows.
I have already tried a fresh clone of the git repo, updated the the java jdk to the newest(oracle jdk 1.8.0_131 before was a _73 and _111 tried both).
All the files in the project are utf-8 encoded, and also tried put javadoc setting into my build.gradle
file,
javadoc {
options.charSet = 'UTF-8'
}
I suspect you want
options.encoding = 'UTF-8'
That would fit with the javadoc help text of:
-encoding <name> Source file encoding name
... whereas charSet
appears to affect the output. (I'd hope it would default to UTF-8 already..)
See more on this question at Stackoverflow