[ERROR] /D:/IDEA文件/travel/src/main/java/cn/itcast/travel/util/MailUtils.java:[1,1] 非法字符: '\ufeff'


報錯:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project travel: Compilation failure: Compilation failure: [ERROR] /D:/IDEA文件/travel/src/main/java/cn/itcast/travel/util/MailUtils.java:[1,1] 非法字符: '\ufeff' [ERROR] /D:/IDEA文件/travel/src/main/java/cn/itcast/travel/util/MailUtils.java:[1,10] 需要class, interface或enum [ERROR] -> Help 1 [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 For more information about the errors and possible solutions, please read the following articles:

 

jdk 的pom.xml:
<plugin>
 <groupId>org.apache.maven.plugins</groupId>
 <artifactId>maven-compiler-plugin</artifactId>
 <configuration>
   <target>1.8</target>
   <source>1.8</source>
   <encoding>UTF-8</encoding>
 </configuration>
</plugin>

 

判斷:

該文件 D:/IDEA文件/travel/src/main/java/cn/itcast/travel/util/MailUtils.java 的編碼錯誤。

處理:

用notepad++打開MailUtils.java文件,查看編碼發現:

 

 

 

 

編碼為utf-8-bom。用notepad++修改編碼為utf-8並保存:

 

 

問題解決。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM