retrofit icon indicating copy to clipboard operation
retrofit copied to clipboard

Publish a BOM

Open mikeholler opened this issue 4 years ago • 2 comments

What kind of issue is this?

  • [ ] Question. This issue tracker is not the place for questions. If you want to ask how to do something, or to understand why something isn't working the way you expect it to, use Stack Overflow. https://stackoverflow.com/questions/tagged/retrofit

  • [ ] Bug report. If you’ve found a bug, spend the time to write a failing test. Bugs with tests get fixed. Here’s an example: https://gist.github.com/swankjesse/6608b4713ad80988cdc9

  • [x] Feature Request. Start by telling us what problem you’re trying to solve. Often a solution already exists! Don’t send pull requests to implement new features without first getting our support. Sometimes we leave features out on purpose to keep the project small.


Hey there! Love the project, but I would love it if there was a BOM file that is published for each version. If you're not familiar with a BOM,it stands for "Bill of Materials" it helps your Gradle (in my case, but it's originally a Maven thing) file look like this:

implementation(platform("com.squareup.retrofit2:retrofit-bom:2.6.1") )
implementation("com.squareup.retrofit2:retrofit")
implementation("com.squareup.retrofit2:converter-jackson")

Instead of this:

val retrofitVersion by extra { "2.6.1" }

implementation("com.squareup.retrofit2:retrofit:$retrofitVersion")
implementation("com.squareup.retrofit2:converter-jackson:$retrofitVersion")

Notice how you just leave the versions off when you use a BOM. This can help reduce the number of dependency compatibility surprises one can encounter, especially if a transitive dependency brings in a newer version of one of the components (it'll be reduced to the BOM's version).

Here's a deeper dive into how a BOM works:

https://howtodoinjava.com/maven/maven-bom-bill-of-materials-dependency/

mikeholler avatar Oct 17 '19 17:10 mikeholler

Just a friendly reminder that according to https://github.com/square/retrofit/pull/2944, BoM was wating for Gradle conversion. Now that the Gradle conversion is done, I'd love for a platform/BoM project to be published.

Could possibly be as easy as:

plugins {
    `java-platform`
}

dependencies {
    constraints {
        rootProject.subprojects.onEach {
            api("${it.group}:${it.name}:$version")
        }
    }
}

tobias- avatar Aug 14 '20 06:08 tobias-

PR welcome!

JakeWharton avatar Aug 14 '20 13:08 JakeWharton