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

Maven无法解析Maven Central中已存在的springdoc-openapi依赖问题

问题根源

你遇到的依赖解析失败的核心原因是org.springdoc:springdoc-openapi是BOM类型的父模块,打包类型为pom,没有提供jar格式的构件,Maven默认按jar类型查找对应依赖,因此哪怕该版本的pom包确实存在于Maven中央仓库,也会提示找不到依赖。


解决方法

根据你的使用场景选择对应方案即可:

  1. 直接集成OpenAPI能力(最常用场景)
    根据你使用的Spring Web框架选择对应的starter依赖:
  • 若使用Spring MVC(即引入了spring-boot-starter-web),替换依赖为:
<dependency>
    <groupId>org.springdoc</groupId>
    <artifactId>springdoc-openapi-ui</artifactId>
    <version>1.5.10</version>
</dependency>
  • 若使用Spring WebFlux(即引入了spring-boot-starter-webflux),替换依赖为:
<dependency>
    <groupId>org.springdoc</groupId>
    <artifactId>springdoc-openapi-webflux-ui</artifactId>
    <version>1.5.10</version>
</dependency>
  1. 统一管理SpringDoc全家桶版本
    如果你需要引入多个SpringDoc相关依赖,想要统一管理版本避免冲突,可以将该依赖作为BOM导入到项目的<dependencyManagement>节点中:
<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springdoc</groupId>
            <artifactId>springdoc-openapi</artifactId>
            <version>1.5.10</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

完成BOM导入后,后续引入其他SpringDoc相关依赖时无需再填写version属性,版本会自动和BOM中声明的1.5.10保持一致。


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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.10.05 05:00:02