You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Maven项目构建失败:依赖文件带.lastUpdated后缀问题求助

解决Maven依赖下载失败(.lastUpdated文件)及SSL连接错误问题

核心问题分析

从错误日志看,关键问题是Unsupported or unrecognized SSL message,这说明Maven连接中央仓库时SSL握手失败,导致依赖下载不完整,生成.lastUpdated后缀文件,进而引发构建失败。

解决方案

1. 彻底清理本地仓库残留文件

删除本地仓库中所有.lastUpdated后缀的无效文件,避免Maven复用:

  • Windows系统:打开命令提示符执行:
cd {userpath}\.m2\repository
for /r %i in (*.lastUpdated) do del %i
  • Linux/macOS系统:执行:
cd ~/.m2/repository
find . -name "*.lastUpdated" -type f -delete

2. 验证JDK与Maven版本兼容性

Maven 3.8.6要求JDK 8及以上版本,同时确保JDK证书库正常:

  • 执行echo %JAVA_HOME%(Windows)或echo $JAVA_HOME(Linux/macOS),确认JAVA_HOME指向正确的JDK路径。
  • 若使用JDK 8,建议更新到最新补丁版本,修复潜在的SSL证书问题。

3. 排查网络代理配置

网络代理可能导致SSL连接异常:

  • 打开Maven的settings.xml(路径:{userpath}\.m2\settings.xml或Maven安装目录conf\settings.xml),检查<proxies>节点:
    • 若使用代理,确保HTTPS代理的protocol、host、port配置正确。
    • 若无需代理,直接注释或删除<proxies>节点。

4. 升级Surefire插件版本

旧版本maven-surefire-plugin:2.12.4与Maven 3.8.6存在兼容性问题,在项目pom.xml中升级到最新稳定版:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>3.2.5</version> <!-- 替换为最新稳定版 -->
        </plugin>
    </plugins>
</build>

5. 手动下载依赖(终极方案)

若以上方法无效,手动从Maven Central下载对应依赖文件,放到本地仓库对应路径:

  • 以surefire-booter-2.12.4为例,前往对应目录下载pom和jar文件,放入{userpath}\.m2\repository\org\apache\maven\surefire\surefire-booter\2.12.4\。

6. 重新执行构建

完成操作后执行命令:

mvn clean install -U

内容的提问来源于stack exchange,提问作者Mahesh M

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.09 06:01:46