question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

Describe the bug

I don’t see it in the project documentation, but from springdoc/springdoc-openapi#1099 & springdoc/springdoc-openapi#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.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
bnasslahsencommented, Dec 24, 2021

@mjustin,

I have enhanced the BOM support so that we get rid of the bomProperty line for next releases. You can already validate it using the latest SNAPSHOT.

1reaction
mjustincommented, Jan 3, 2022

I can confirm that the updated BOM works as desired in my Gradle project where I found this issue. Thanks for the quick fix!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using springdoc-openapi as BOM uses Gradle project verson ...
When I use this project as a BOM with Gradle using the Spring dependency management plugin, it uses the version of my Gradle...
Read more >
Sharing dependency versions between projects
Catalogs can separate the group and name of a dependency from its actual version and use version references instead, making it possible to...
Read more >
Springdoc-openapi
Automatically generates documentation in JSON/YAML and HTML format APIs. This documentation can be completed by comments using swagger-api ...
Read more >
Can't print versions from BOM - gradle - Stack Overflow
In build.gradle: plugins { id 'application' id "com.nocwriter.runsql" version "1.0.3" id 'idea' id "io.spring.dependency-management" version ...
Read more >
OpenAPI 3 documentation for your Spring REST API with ...
Using springdoc-openapi allows generating the REST API documentation ... add the following line into your dependencies in build.gradle file:.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found