IDEA 打包Spring Boot项目报错:Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:

IDEA 打包Spring Boot项目报错:Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources) on project randomaward: Input length = 1 -> [Help 1]

今天在打包项目的时候遇到一个这样的问题。

[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources) on project randomaward: 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

解决办法:

1、确认是否为UTF-8格式

IDEA 打包Spring Boot项目报错:Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:

 

 2、更改完UTF-8之后,application.yml会发生变化

 启动项目时可能会报如下错误:

org.yaml.snakeyaml.error.YAMLException: java.nio.charset.MalformedInputException: Input length = 1

问题原因:

  application.yml 文件编写错误,一般情况在于空格多或者少的原因,检查下空格
  application.yml 编码发生了改变,GBK和UTF-8两种编码格式的问题
解决:
  最快最有效的方法就是复制application.yml上的所有东西,删除当前application.yml文件,新建application.yml,粘贴上即可
说明:不管是否报错,都最好删除application.yml重新建一次(亲试有效)。

 

3、跳过测试模式

IDEA 打包Spring Boot项目报错:Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:

 IDEA 打包Spring Boot项目报错:Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:

 

 4、开始打包

IDEA 打包Spring Boot项目报错:Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:

 如图即成功:

IDEA 打包Spring Boot项目报错:Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:

 

到这里jar就打包完成啦!

 

上一篇:consul配置使用


下一篇:@ResponseStatus