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

spring-data-jdbc依赖在pom.xml中失效,Maven4.0.0报错找不到仓库文件

解决spring-data-jdbc 1.0.0.M2依赖找不到的问题

你遇到的问题主要来自两个方面:里程碑版本的仓库配置缺失,以及Maven版本兼容性冲突,下面一步步给你解决:

  • 配置Spring里程碑仓库
    1.0.0.M2是Spring的里程碑(Milestone)预发布版本,这类版本不会上传到Maven中央仓库的正式发布库,默认Maven只会从中央仓库拉取稳定release版本。你需要在pom.xml中添加Spring的里程碑仓库配置:

    <repositories>
        <repository>
            <id>spring-milestones</id>
            <name>Spring Milestones</name>
            <url>https://repo.spring.io/milestone</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>
    
  • 调整Maven版本
    你使用的Maven 4.0.0是较新的版本,而spring-data-jdbc 1.0.0.M2是非常早期的版本(2018年左右发布),两者可能存在兼容性冲突。建议你降级到Maven 3.x系列的稳定版本(比如3.8.6),这个版本和绝大多数老Spring生态依赖都能完美兼容。

  • 额外建议:升级到稳定版依赖
    如果不是必须使用1.0.0.M2这个老版本,强烈建议你切换到spring-data-jdbc的正式稳定版。稳定版不仅不需要额外配置仓库,还修复了大量bug,功能更完善。比如最新的稳定版依赖可以这样配置(可以根据实际需求调整版本号):

    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-jdbc</artifactId>
        <version>3.2.4</version>
    </dependency>
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.26 08:51:25