Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.5.9.RELEASE:repackage (default) on project scf-core: Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.5.9.RELEASE:repackage failed: Plugin org.springframework.boot:spring-boot-maven-plugin:1.5.9.RELEASE or one of its dependencies could not be resolved: Failed to collect dependencies at org.springframework.boot:spring-boot-maven-plugin:jar:1.5.9.RELEASE -> org.apache.maven.plugins:maven-shade-plugin:jar:2.2 -> org.vafer:jdependency:jar:0.7 -> commons-io:commons-io:jar:1.3.2: Failed to read artifact descriptor for commons-io:commons-io:jar:1.3.2: Could not transfer artifact commons-io:commons-io:pom:1.3.2 from/to central (https://repo.maven.apache.org/maven2): Received fatal alert: protocol_version -> [Help 1]
1条回答 默认 最新
雪豹同志 2025-06-01 07:51关注这个Maven打包错误主要原因是无法解析 org.springframework.boot:spring - boot - maven - plugin:1.5.9.RELEASE 及其依赖,具体是在下载 commons - io:commons - io:jar:1.3.2 的POM文件时出现 protocol_version 致命警报错误,无法从中央仓库传输。以下是一些解决办法:
- 检查网络和仓库连接
- 网络代理:如果处于有网络代理的环境,检查Maven的 settings.xml 配置文件(一般在 ${user.home}/.m2 目录下 ),确保代理配置正确。示例代理配置如下:
- 仓库地址:确认中央仓库地址 https://repo.maven.apache.org/maven2 能正常访问。可以尝试在浏览器中打开该地址,若无法访问,可能是网络问题或仓库维护。也可在 settings.xml 中配置其他可用的镜像仓库,比如阿里云镜像:
- 清理本地仓库并重新下载依赖
- 打开命令行,进入项目根目录,执行 mvn clean 命令清理项目的target目录和本地Maven仓库中已下载的不完整依赖。
- 接着执行 mvn install 重新下载所有依赖并打包项目。
- 检查依赖版本兼容性
- 确认项目中 spring - boot - maven - plugin 版本 1.5.9.RELEASE 与项目整体的Spring Boot版本以及其他依赖是否兼容。有时低版本插件可能与高版本的某些依赖存在冲突。可以查看Spring Boot官方文档,确认推荐的插件版本。如果版本不兼容,尝试升级或降级 spring - boot - maven - plugin 版本,修改 pom.xml 中相关配置,例如:
然后重新执行 mvn clean install 。
- 检查SSL配置
- 若网络使用了SSL连接,Maven可能因SSL证书问题无法下载依赖。可以尝试在 settings.xml 中添加如下配置忽略SSL验证(不推荐在生产环境使用):
环境使用):
更好的做法是导入正确的SSL证书到JDK的信任库中。
解决 无用评论 打赏 举报