美文网首页
maven 项目编译 出现 编码gbk的不可映射字符

maven 项目编译 出现 编码gbk的不可映射字符

作者: 2010jing | 来源:发表于2016-06-14 20:47 被阅读262次

通过Maven2来编译工程,Java文件中出现中文,则报错:
编码 GBK 的不可映射字符,这是由于m2默认是用GBK格式的。
解决方案:在pom.xml文件的根节点下添加

需要在 porm.xml 添加

<properties>
       ...
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>  
</properties>

相关文章

网友评论

      本文标题:maven 项目编译 出现 编码gbk的不可映射字符

      本文链接:https://www.haomeiwen.com/subject/fvmudttx.html