I’m looking to add `org.springframework.boot:sprin...
# gradle
e
I’m looking to add
org.springframework.boot:spring-boot-dependencies
(bom) to my bom I’m publishing so that only 1 line of
Copy code
implementation(platform("com.example:common-bom:1.0-SNAPSHOT"))
is needed instead of needing both platforms like this:
Copy code
implementation(platform("com.example:common-bom:1.0-SNAPSHOT"))
implementation(platform("org.springframework.boot:spring-boot-dependencies:2.5.10"))
Is there a doc showing how to do that?
My
platform/build.gradle.kts
looks like this:
Copy code
plugins {
    `java-platform`
    `maven-publish`
    id("com.jfrog.artifactory")
}

javaPlatform {
    allowDependencies()
}

dependencies {
    // keep kotlin, kotlin-reflect and all others in line using the kotlin bom
    api(enforcedPlatform(kotlin("bom:1.5.32")))
    // allow spring boot to dictate as many versions as possible
    api(enforcedPlatform("org.springframework.boot:spring-boot-dependencies:2.5.10"))
    constraints {
        // subprojects
        api(project(":common"))
        api(project(":testing"))
        api(project(":structured-kotlin-logging"))
        api(project(":spring"))
        api(project(":hibernate"))
        platform("org.springframework.boot:spring-boot-dependencies:2.5.10")
    }
}

publishing {
    publications {
        create<MavenPublication>("bom") {
            groupId = "com.example"
            artifactId = "common-bom"
            version = project.parent?.version?.toString()
            from(components["javaPlatform"])
        }
    }
}

artifactory.publish {
    defaults {
        publications("bom")
    }
}

tasks.withType<GenerateModuleMetadata> {
    suppressedValidationErrors.add("enforced-platform")
}
Not sure why, but this appears to work now.