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

pom.xml已配置依赖仍出现Maven依赖(spring-context)缺失问题如何解决

问题排查及解决步骤

当前你的pom.xml配置存在两处直接导致依赖无法正常加载的错误:

  • spring-context的<artifactId>标签值末尾存在多余空格,你写的是<artifactId>spring-context </artifactId>,多余空格会导致Maven无法匹配到正确的依赖坐标
  • 所有Spring依赖都额外添加了<type>module</type>配置,Spring Framework的常规jar包不需要指定type为module,该配置会导致Maven拉取对应类型的构件失败,无法加入依赖列表

具体修复操作

  1. 修正pom.xml中的依赖配置:
    移除所有Spring依赖中的<type>module</type>行,同时删除spring-context artifactId末尾的多余空格,修正后的依赖配置参考如下:
<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.11</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-beans</artifactId>
        <version>5.3.10</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>5.3.10</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>5.3.10</version>
    </dependency>
</dependencies>
  1. 保存pom.xml后,右键项目执行 Maven -> Update Maven Project,勾选「Force Update of Snapshots/Releases」选项后确认执行
  2. 如果执行后依赖仍未正常加载,可清空本地Maven仓库中org/springframework路径下的5.3.10版本缓存文件,再重新执行更新操作

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.10.01 20:06:02