我有一個Maven的項目,該項目是使用以下屬性配置:Maven項目源編碼不起作用
<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>
在我的機器一切正常使用這些設置。然而,另一臺機器上,當我檢查出來,並嘗試使用mvn install
編譯器錯誤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
我已經嘗試運行mvn
與-Dfile.encoding=UTF-8
但沒有幫助。 $LC_CTYPE
報告UTF-8
。
我該怎麼辦?
您可以在這裏看到完整的POM文件:https://github.com/scravy/scuttle/blob/master/pom.xml
您是否100%確定您的源代碼是UTF-8編碼的?可能它們不是,但它在你的環境中出於某種原因工作(也許你的IDE會干擾) – sola
請更新你的maven-compiler-version原因2.0.2真的很舊。目前我們有3.1 .. – khmarbaise
與默認的maven-compiler插件v2.0.2有相同的問題。增加版本解決問題。 – gavenkoa