Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure encoding in Maven?

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! 

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> 

...to my pom.xml. But it's already there (in the parent pom.xml).

Configuring <encoding> for the maven-resources-plugin or the maven-compiler-plugin also doesn't fix it.

So what's the problem?

like image 522
Ethan Leroy Avatar asked Jun 10 '10 19:06

Ethan Leroy


People also ask

How You Can Produce execution debug output or error messages?

How to produce execution debug output or error messages? You could call Maven with -X parameter or -e parameter. For more information, run: mvn --help.

What is Maven Shade plugin?

This plugin provides the capability to package the artifact in an uber-jar, including its dependencies and to shade - i.e. rename - the packages of some of the dependencies.

What is Maven resources plugin?

The Resources Plugin handles the copying of project resources to the output directory. There are two different kinds of resources: main resources and test resources.


1 Answers

OK, I have found the problem.

I use some reporting plugins. In the documentation of the failsafe-maven-plugin 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

like image 113
Ethan Leroy Avatar answered Sep 29 '22 13:09

Ethan Leroy