1. 程式人生 > >IDEA maven編譯專案時報錯 非法字元: \65279或 需要class, interface或enum

IDEA maven編譯專案時報錯 非法字元: \65279或 需要class, interface或enum

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.2:compile (default-compile) on project king_p2p_utils: Compilation failure: Compilation failure:
[ERROR] /D:/JetBrains/IntelliJ IDEA 2017.3.5/workspace/src/main/java/com/lee/utils/InvestTradeType.java:[1,1] 非法字元: \65279
[ERROR] /D:/JetBrains/IntelliJ IDEA 2017.3.5/workspace/p2p/src/main/java/com/lee/utils/InvestTradeType.java:[1,10] 需要class, interface或enum
[ERROR] /D:/JetBrains/IntelliJ IDEA 2017.3.5/workspace/p2p/src/main/java/com/lee/utils/FundsFlowType.java:[1,1] 非法字元: \65279
[ERROR] /D:/JetBrains/IntelliJ IDEA 2017.3.5/workspace/p2p/src/main/java/com/lee/utils/FundsFlowType.java:[1,10] 需要class, interface或enum
[ERROR] -> [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/MojoFailureException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command


解決方法:

    1. 選擇file encoding

    

    2. 再選擇UTF-8編碼

     

    3. 當你的檔案編碼格式與上一步操作選擇的不一致的時候會出現這個提示框

    

    4. 點選Convert就OK