I'm trying to setup my installed maven 3.0.3 on Cp1252 encoding. Is it possible to change the encoding WITHOUT editing one of the pom.xml-files? maybe creating a profile for the compiler-plugin in settings.xml? If yes, how to do that? The following didn't work:
<settings>
...
<profiles>
<profile>
<id>encoding</id>
<activation>
<activeByDefault>true</activeByDefault&开发者_C百科gt;
</activation>
<build>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<encoding>Cp1252</encoding>
</configuration>
</plugin>
</build>
</profile>
</profiles>
<activeProfiles>
<activeProfile>encoding</activeProfile>
</activeProfiles>
</settings>
Ok, I solved the problem by adding
-Dfile.encoding=CP1252
to the global MAVEN_OPTS
Put into your root pom of your project:
<properties>
<project.build.sourceEncoding>cp1252</project.build.sourceEncoding>
</properties>
Which defines it for all sub-project which use this pom as parent. Otherwise your build is not reproduciable.
精彩评论