Does the java-platform plugin support the import scope?

I love the new BOM support in Gradle 5, but there’s one issue I’m having while attempting to create a bill of materials with the java-platform plugin. I can successfully create a BOM for dependencies, but I’m unable to include another BOM with the import scope. I have created a sample project at to demonstrate what happens. I’d expect that the POM includes the dependency with the “import” scope, but it’s including it with the “compile” scope.

Does the plugin support this and I just need to change my code, or is this a missing feature? I wanted to ask before I submitted an issue on GitHub.

Did you ever find anything out about this?

I had a need to research this myself a while back. Here’s what I bookmarked then:

Here’s a relevant 2012 comment by Gradle dev @Peter_Niederwieser:

I did figure it out! You need to allow dependencies as the documentation describes, and include the platform dependency outside of the constraints block. Build the bom and inspect it after that change, and it looks as expected.

The solution you describe is not reflected in the example repository you linked earlier, so I’ll post it just for the record:

plugins {
    id 'java-platform'
    id 'maven-publish'

dependencies {
    api platform("org.springframework.boot:spring-boot-dependencies:2.1.4")
    constraints {
        api 'commons-logging:commons-logging:1.2'
publishing {
    publications {
        library(MavenPublication) {
            from components.javaPlatform

Also there’s a interesting thing you can do in multimodule builds, if your base project is a java-platform you may import that in your subprojects:

dependencies {
    implementation platform(project(':'))