如何在Maven中配置编码? [英] How to configure encoding in Maven?
问题描述
当我在多模块maven项目中运行 maven install
时,我总是得到以下输出:
When I run maven install
on my multi module maven project I always get the following output:
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
所以,我googled了一点,但我可以找到的是,我必须添加: / p>
So, I googled around a bit, but all I can find is that I have to add:
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
...到我的pom.xml。但是它已经存在(在父 pom.xml
中)。
...to my pom.xml. But it's already there (in the parent pom.xml
).
配置 maven-resources-plugin或maven-compiler-plugin的编码>
也不会修复它。
那么问题是什么?
推荐答案
问题。
我使用一些报告插件。在failafe-maven插件的文档中( http: //maven.apache.org/plugins/maven-failsafe-plugin/integration-test-mojo.html )我发现,< encoding>
当然,配置默认使用 $ {project.reporting.outputEncoding}
。所以我添加了这个属性作为项目
元素的子元素,现在一切都很好:
I use some reporting plugins. In the documentation of the failsafe-maven-plugin (http://maven.apache.org/plugins/maven-failsafe-plugin/integration-test-mojo.html) I found, that the <encoding>
configuration - of course - uses ${project.reporting.outputEncoding}
by default. So I added the property as a child element of the project
element and everything is fine now:
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
另请参见 http://maven.apache.org/general .html#encoding-warning
这篇关于如何在Maven中配置编码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!