spring-projects / spring-restdocs

Test-driven documentation for RESTful services
https://spring.io/projects/spring-restdocs
Apache License 2.0
1.16k stars 735 forks source link

Set encoding of Javadoc and CompileJava tasks to avoid relying on platform's default being UTF-8 #593

Closed clydebarrow closed 5 years ago

clydebarrow commented 5 years ago

The presence of non-ascii characters in Javadoc annotations causes failures when executing the spring-restdocs-core:javadoc gradle task.

> Task :spring-restdocs-core:javadoc FAILED
/Users/clyde/dev/opensourceprojects/spring-restdocs/spring-restdocs-core/src/main/java/org/springframework/restdocs/payload/JsonContentHandler.java:35: error: unmappable character for encoding ASCII
 * @author Mathias D??sterh??ft

The fix is to add options.encoding = 'UTF-8' to the javadoc closure in build.gradle.

wilkinsona commented 5 years ago

Thanks. I guess I haven't seen this locally or on CI as they're using UTF-8 by default. We shouldn't rely upon that though.

wilkinsona commented 5 years ago

While it's apparently only the javadoc task that breaks when the build's run with a non-UTF-8 encoding, we should set the encoding on the JavaCompile tasks too.

clydebarrow commented 5 years ago

Fixed in #592

wilkinsona commented 5 years ago

This needs to be fixed in all maintained branches so we'll need to handle it separately to #592. I'll take care of that and then we can rebase #592 on top.