编译时Maven抛出IllegalCharsetNameException

时间:2017-04-13 13:20:12

标签: java maven

当我使用Maven编译代码时,我收到以下错误。

有人可以解释为什么会发生这种情况并帮我解决吗?

我的错误:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.269 s
[INFO] Finished at: 2017-04-13T13:59:38+02:00
[INFO] Final Memory: 11M/307M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.6.1:compile (default-compile) on project panima: Fatal error compiling: CompilerException: IllegalCharsetNameException -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Process finished with exit code 1

1 个答案:

答案 0 :(得分:0)

Probably your compiler encoding property is lacking, try adding the following in your pom;

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

Details of encoding property of maven compiler plugin