1. BUG 场景

博主是使用 idea 的 spring Initializr 创建的 springboot 项目。
完成初步功能后进行 build 时出现 build failure 错误。
pox.xml 无修改过 <build> 标签内容。
完整的报错信息如下

2. BUG 完整信息

[INFO] Scanning for projects...
[INFO] 
[INFO] -------------------------< com.alun:project_name >-------------------------
[INFO] Building project_name 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) @ project_name ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] Copying 1 resource
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.706 s
[INFO] Finished at: 2021-01-05T14:30:41+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources) on project project_name: 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

3. 解决方案

因为第一条 [ERROR] 已经提示 使用默认的 maven-resources-plugin:3.2.0:resources 失败,所以第一反应是修改版本。
即在 springboot 项目中的 pox.xml 文件指定恰当的 maven-resources-plugin 版本即可,示例如下:

<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-resources-plugin</artifactId>
	<!--指定恰当版本-->
    <version>3.1.0</version>
</plugin>

就此,已解决。

Logo

北京人形旗下天工造物具身智能开源社区,聚焦具身天工与慧思开物两大平台

更多推荐