eclipse Jenkins 构建在编译时失败,使用“用于编码 ASCII 的不可映射字符”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11901073/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 21:15:28  来源:igfitidea点击:

Jenkins build fails at compile with "unmappable character for encoding ASCII"

eclipsesvnencodingutf-8character-encoding

提问by Pete

I have a .java file that contains UTF-8 characters. So I told eclipse to use UTF-8 encoding for its .java files. When trying to build it via Jenkins it fails however with

我有一个包含 UTF-8 字符的 .java 文件。所以我告诉 eclipse 对其 .java 文件使用 UTF-8 编码。当尝试通过 Jenkins 构建它时,它失败了

[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Compilation failure

.../... unmappable character for encoding ASCII

When browsing to my svn repository I notice that the special characters are encoded using weird signs. Is there a way to get those characters into my repository correctly? Do I have to tell my svn repository to use UTF-8 somehow. Or my subclipse plugin..?

当浏览到我的 svn 存储库时,我注意到特殊字符是使用奇怪的符号编码的。有没有办法将这些字符正确地放入我的存储库?我是否必须告诉我的 svn 存储库以某种方式使用 UTF-8。还是我的 subclipse 插件..?

Edit

编辑

Updated my question to help others locate the problem.

更新了我的问题以帮助其他人定位问题。

采纳答案by Pete

  • 将 svn:mime-type 设置为 text/plain;charset=UTF-8 ,eclipse team> set property > change value > commit

  • 像您一样将文件内容编码设置为 utf-8

  • 在编译插件的 pom.xml 中将 Encoding 设置为 utf-8:

  • http://maven.apache.org/general.html#encoding-warning

回答by Pete

As discovered correctly by Philippe Bossu it wasn't an issue with svn or eclipse after all but a maven setting. No idea, why it built locally but appearently you have to set the maven compiler pluginencoding:

正如 Philippe Bossu 正确发现的那样,这毕竟不是 svn 或 eclipse 的问题,而是maven 设置的问题。不知道,为什么它在本地构建,但显然您必须设置maven 编译器插件编码:

<build>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
                <encoding>UTF-8</encoding>
            </configuration>
        </plugin>