在使用 maven 对 Spring Boot 项目打包时,抛出:[ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources) on project springboot_devtools_demo1: Input length = 1 -> [Help 1] 错误。详细错误信息如下:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources) on project springboot_devtools_demo1: Input length = 1 -> [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
这个问题是由于项目的 application.properties 配置文件编码导致。文件编码为 GB2312,将它改为 UTF 编码即可。
注意:在改变编码之前,先将配置文件备份,不然可能导致配置文件出现中文乱码。配置文件改变成 UTF-8 编码后,将备份配置文件中的内容拷贝过来即可,将改变编码后的乱码配置全部覆盖即可。