[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.pluginsgroupId>
 <artifactId>maven-compiler-pluginartifactId>
 <configuration>
   <target>1.8target>
   <source>1.8source>
   <encoding>UTF-8encoding>
 configuration>
plugin>

 

判断:

该文件 D:/IDEA文件/travel/src/main/java/cn/itcast/travel/util/MailUtils.java 的编码错误。

处理:

用notepad++打开MailUtils.java文件,查看编码发现:

 

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

 

 

编码为utf-8-bom。用notepad++修改编码为utf-8并保存:

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

 

 

问题解决。

转载于:https://www.cnblogs.com/bloggary/p/11506684.html

你可能感兴趣的:([ERROR] /D:/IDEA文件/travel/src/main/java/cn/itcast/travel/util/MailUtils.java:[1,1] 非法字符: '\ufeff'...)