简体   繁体   English

Javadoc 生成失败。 用于编码 ASCII 的不可映射字符

[英]Javadoc generation failed. Unmappable character for encoding ASCII

When I want to build the project using IntelliJ and Gradle I get two errors:当我想使用 IntelliJ 和 Gradle 构建项目时,出现两个错误:

Execution failed for task ':javadoc'.
Javadoc generation failed.

and

error: unmappable character for encoding ASCII
W??hrung

Here I use the German Umlaut 'ä' on one of the file in the project.在这里,我在项目中的一个文件上使用了德语变音符号“ä”。

Three of my work colleagues have exactly the same project using also IntelliJ and have the same setting in Preferences>Editor>File Encoding like i do.我的三个同事也使用 IntelliJ 有完全相同的项目,并且在 Preferences>Editor>File Encoding 中具有相同的设置,就像我一样。 But the project is build successfully by my work colleagues.但是该项目是由我的同事成功构建的。

I found a temporary solution to put the following lines in the build.gradle:我找到了一个临时解决方案,将以下几行放入 build.gradle 中:

javadoc {
    options.encoding = 'UTF-8'
}

Why I get the errors when I build the project?为什么我在构建项目时会出现错误?

If you generate your Javadocs with a Gradle Task your IntelliJ Configuration does not matter since Gradle only reads the Gradle Configuration (build.gradle).如果您使用 Gradle 任务生成 Javadocs,则您的 IntelliJ 配置无关紧要,因为 Gradle 仅读取 Gradle 配置(build.gradle)。 Therefore you have to set the file encoding in Gradle.因此您必须在 Gradle 中设置文件编码。

You may configure Gradle to always use UTF-8 -> Stackoverflow issue on how to set encoding to UTF-8您可以将 Gradle 配置为始终使用 UTF-8 ->有关如何将编码设置为 UTF-8 的 Stackoverflow 问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM