You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Christoph Schönfeld <cs...@sylphen.com> on 2005/11/10 09:33:52 UTC
[M2] How to control Java source file encoding used by javac
Hi,
for Maven 1 there was a property to set, maven.compile.encoding.
How is that set in Maven 2.0?
I tried mvn -Dmaven.compile.encoding=UTF-8 compile, but the build still
fails at a file containing UTF-8 characters.
Thanks in advance,
Christoph
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: [M2] How to control Java source file encoding used by javac
Posted by Christoph Schönfeld <cs...@sylphen.com>.
I figured this out myself. Here is the setting I use in the topmost
pom.xml of my project.
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</build>
However, I have one question: Is there any other/better way to do it?
Using mvn projecthelp:effective-pom, I found out that the setting
automatically applies to child modules which is very nice. This seems to
be the case even when Maven is called in a directory of such a child
module, as long as it is correctly linked via <parent>. I assume this
stuff happens when Maven says "Scanning for projects...", someone on
this list called it "global source tree", IIRC.
To improve understanding of how Maven works, I suggest this fact be
mentioned in the multi-project guideline.
Christoph
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org