Skip to content

Using springdoc-openapi as BOM uses Gradle project verson rather than BOM version #1405

Closed
@mjustin

Description

@mjustin

Describe the bug

I don't see it in the project documentation, but from #1099 & #1256, it looks like springdoc-openapi is designed to be used as a BOM, enforcing the dependency versions in the project to match the version of the BOM.

When I use this project as a BOM with Gradle using the Spring dependency management plugin, it uses the version of my Gradle project as the SpringDoc versions, rather than the version of the BOM. For instance, if I have my Gradle project at version 0.0.1, use org.springdoc:springdoc-openapi:1.6.1 as a BOM, and import org.springdoc:springdoc-openapi-ui, the version of springdoc-openapi-ui will be 0.0.1, not 1.6.1.

To Reproduce

build.gradle

plugins {
    id 'org.springframework.boot' version '2.6.1'
    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
    id 'java'
}

group = 'com.example'
version = '0.0.1'
sourceCompatibility = '11'

repositories {
    mavenCentral()
}

dependencyManagement {
    imports {
        mavenBom 'org.springdoc:springdoc-openapi:1.6.1'
        mavenBom 'org.springframework.boot:spring-boot-dependencies:2.6.1'
    }
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter'
    implementation 'org.springdoc:springdoc-openapi-ui'
}

Execute

$ gradle compileJava

> Task :compileJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Could not resolve all files for configuration ':compileClasspath'.
   > Could not find org.springdoc:springdoc-openapi-ui:0.0.1.
     Required by:
         project :

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s
1 actionable task: 1 executed

Expected behavior

The expected behavior is that the version used for the springdoc-openapi BOM be used for the org.springdoc dependencies.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions