maven-javadoc-plugin error javadoc: error - cannot read Input length = 1 with non-ASCII characters in directory name

╄→гoц情女王★ 提交于 2019-12-05 07:16:43

As you say, this looks like the encoding used to write the files to target/apidocs.

Looking through the source for the maven-javadoc-plugin, it is just using the platform encoding when writing these files - e.g. this line.

Directly setting the encoding while calling Maven repaired the example above for me:

mvn clean package -Dfile.encoding=UTF-8

This feels more like a workaround than a good fix though - it needs to assume there is nothing else depending on the platform encoding in the Maven build.

I think the cause is a change in the main JDK between 8 and 9. The bit of code (actually under javac) that parses the argument files (e.g. @options in the javadoc command line) has switched from using the platform encoding here to calling Files.newBufferedReader() here. Files.newBufferedReader(Path) states that it uses UTF-8 if the encoding is not specified. This means argument files, in both javac and javadoc, must now be encoded in UTF-8.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!