闲得无聊的时候从网上搜了个项目想做做玩,结果运行初期就报错如下,
[INFO] Total time: 2.380 s
[INFO] Finished at: 2020-07-08T22:53:03+08:00
[INFO] Final Memory: 10M/152M
[INFO] ------------------------------------------------------------------------
[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] /E:/ideaProject/travel/src/main/java/cn/itcast/travel/util/MailUtils.java:[1,1] 非法字符: '\ufeff'
[ERROR] /E:/ideaProject/travel/src/main/java/cn/itcast/travel/util/MailUtils.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
Process finished with exit code 1
在网上搜了各种方法都没成功,有的需要改maven的setting.xml文件,有的需要配置jdk,但是都无法解决我这个问题,后来换了个搜索方式【maven 报错非法字符'\ufeff'】
才终于解决,办法如下:
Idea在maven打包时报非法字符: '\ufeff' ,但打开报错的类看没有问题,后来发现是隐蔽字符BOM的问题,解决办法是用Notepad++打开这个类,然后改变编码格式为UTF-8 无DOM模式。