Skip to content

Instantly share code, notes, and snippets.

@liweigong
Created April 13, 2017 08:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save liweigong/98b002d45fba612672ce5f61fd71e4e8 to your computer and use it in GitHub Desktop.
Save liweigong/98b002d45fba612672ce5f61fd71e4e8 to your computer and use it in GitHub Desktop.
maven 打包编译时候的警告处理
maven打包编译时后台一直输出警告信息
[WARNING] File encoding has not been set, using platform encoding GBK, i.e. build is platform dependent!
找了半天,原来只要在pom.xml文件中增加一个配置项即可
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
------------------------------------------
http://stackoverflow.com/questions/3017695/how-to-configure-encoding-in-maven
OK, I found the problem.
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>
See also http://maven.apache.org/general.html#encoding-warning
------------------------------------------
[WARNING] Some problems were encountered while building the effective model for com.ldygo:zhuanche_common_config:jar:1.0
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-resources-plugin is missing. @ line 23, column 12
Add a <version> element after the <plugin> <artifactId> in your pom.xml file. Find the following text:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
Add the version tag to it:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
The warning should be resolved.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment