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

Eclipse中Maven项目pom.xml报错:Unsupported or unrecognized SSL message

Maven仓库SSL传输错误解决方案(Unsupported or unrecognized SSL message)

问题场景

在Eclipse中创建Maven项目后,pom.xml出现以下错误:

无法从https://repo.maven.apache.org/maven2传输commons-lang:commons-lang:pom:2.1,该失败已缓存在本地仓库中,在central仓库的更新间隔结束或强制更新前不会重新尝试解析。原始错误:无法从/向central(https://repo.maven.apache.org/maven2)传输构件commons-lang:commons-lang:pom:2.1:Unsupported or unrecognized SSL message

环境信息:

  • Java版本:1.8.0_291
  • Maven版本:3.8.6

解决方案

1. 清理本地仓库缓存

Maven会缓存失败的请求记录,优先清理对应依赖的缓存:

  • 找到本地仓库默认路径~/.m2/repository,删除commons-lang/commons-lang/2.1目录下的所有文件(包括.lastUpdated后缀的缓存文件)
  • 或者在Eclipse中执行:右键项目 → Run As → Maven Clean,再执行Maven Install

2. 配置Maven强制使用TLS 1.2

Maven 3.8+默认要求仓库使用TLS 1.2+,需确保配置正确:

  1. 打开Maven的settings.xml文件(路径为~/.m2/settings.xml或Maven安装目录conf/settings.xml)
  2. 添加以下profile配置并激活:
<profiles>
    <profile>
        <id>jdk-1.8-tls</id>
        <activation>
            <jdk>1.8</jdk>
        </activation>
        <properties>
            <maven.wagon.http.ssl.insecure>false</maven.wagon.http.ssl.insecure>
            <maven.wagon.http.ssl.allowall>false</maven.wagon.http.ssl.allowall>
            <maven.wagon.http.protocol>https</maven.wagon.http.protocol>
            <maven.compiler.source>1.8</maven.compiler.source>
            <maven.compiler.target>1.8</maven.compiler.target>
        </properties>
    </profile>
</profiles>

<activeProfiles>
    <activeProfile>jdk-1.8-tls</activeProfile>
</activeProfiles>

3. 配置Java运行时强制使用TLS 1.2

在Eclipse中为Maven添加VM参数:

  • 右键项目 → Run As → Run Configurations → 选择Maven Build → 切换到Arguments标签
  • 在VM arguments中添加:
-Dhttps.protocols=TLSv1.2

4. 检查网络代理设置

如果使用代理,确保代理支持HTTPS流量,在settings.xml中配置正确的代理信息:

<proxies>
    <proxy>
        <id>proxy-config</id>
        <active>true</active>
        <protocol>https</protocol>
        <host>你的代理地址</host>
        <port>代理端口</port>
        <!-- 如需认证,添加用户名密码 -->
        <username>代理用户名</username>
        <password>代理密码</password>
        <nonProxyHosts>localhost|*.local</nonProxyHosts>
    </proxy>
</proxies>

若无需代理,确保系统和Maven配置中无多余代理设置。

5. 强制更新依赖

在Eclipse中执行:右键项目 → Maven → Update Project,勾选Force Update of Snapshots/Releases后点击OK;
或使用命令行执行:

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.10 00:25:30