Reputation: 12283
I am having a Maven-Project which is configured using the following properties:
<properties>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
On my machine everything works fine with these settings. However, on another machine, when I check it out and try to build it using mvn install
the compiler errors unmappable character for encoding ASCII
:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project scuttle: Compilation failure: Compilation failure:
[ERROR] /export/local-1/julian-downloads/scuttle/src/main/java/de/fu/mi/scuttle/handlers/sakai/SakaiVV.java:[99,39] error: unmappable character for encoding ASCII
[ERROR]
[ERROR] /export/local-1/julian-downloads/scuttle/src/main/java/de/fu/mi/scuttle/handlers/sakai/SakaiVV.java:[99,40] error: unmappable character for encoding ASCII
[ERROR]
[ERROR] /export/local-1/julian-downloads/scuttle/src/main/java/de/fu/mi/scuttle/domain/sakai/SakvvTermin.java:[66,30] error: unmappable character for encoding ASCII
[ERROR]
[ERROR] /export/local-1/julian-downloads/scuttle/src/main/java/de/fu/mi/scuttle/domain/sakai/SakvvTermin.java:[66,31] error: unmappable character for encoding ASCII
I've already tried running mvn
with -Dfile.encoding=UTF-8
but that did not help. $LC_CTYPE
reports UTF-8
.
What can I do?
You can see the complete pom file here: https://github.com/scravy/scuttle/blob/master/pom.xml
Upvotes: 5
Views: 17051
Reputation: 3059
Instead of setting maven
opts, set new environmental variable - JAVA_TOOL_OPTIONS = -Dfile.encoding=UTF8
Upvotes: 1
Reputation: 12283
In the end the comment by khmarbaise helped me find a solution:
I configured the compiler plugin and specified the source encoding there, now everything works everywhere:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</build>
Upvotes: 10
Reputation: 30310
You have all the right settings in your pom, so that's good. Verify your IDE (and the others used by your team if applicable) is configured for UTF-8.
Next, clean out your local .m2
repository and run your build again. It might be possible one of your transitive dependencies wasn't compiled with the right encoding. But you may have the "right" version in your .m2
that makes everything OK while the same version doesn't exist on the other machine.
Good luck! I know how annoying this stuff can be.
Upvotes: 2