Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support platform/BOM for plugin management #21788

Open
Meijuh opened this issue Sep 1, 2022 · 5 comments
Open

Support platform/BOM for plugin management #21788

Meijuh opened this issue Sep 1, 2022 · 5 comments
Labels

Comments

@Meijuh
Copy link

Meijuh commented Sep 1, 2022

I would like to see support for Maven BOMs for plugin management. As far as I can tell by reading https://docs.gradle.org/current/userguide/plugins.html this is not supported.

Expected Behavior

I would like to be able to specify Maven BOMs in the buildscript (or pluginManagement) block. Somewhat like the following:

buildscript {
	repositories {
                mavenLocal()
		gradlePluginPortal()
	}
	dependencies {
                platform "group:artifact-bom:1.1.1"
		classpath "org.springframework.boot:spring-boot-gradle-plugin"
                classpath "gradle.plugin.org.flywaydb:gradle-plugin-publishing"
	}
}

Current Behavior

Currently, the platform function does not have any effect, and classpath requires me to specify a version.

Context

One small example where this feature is useful, is that in artifact-bom I can specify a version of Spring Boot, and a version for the Flyway plugin. Since Spring Boot dependency management specifies a particular Flyway version, it would be good to match that Flyway version with the Flyway Gradle plugin. Over multiple projects that use artifact-bom we would then not have to worry about what an appropriate version for the Flyway plugin is.
Another useful case is where one could have a set of "convention" plugins which' versions could be specified in artifiact-bom.

@jbartok
Copy link
Member

jbartok commented Sep 2, 2022

Sorry that you're having trouble with Gradle!

Your issue lacks information about how to reproduce the problem you're having. A reproducer project can really help us track down and fix your problem quicker. We may also be able to suggest workarounds or ways to avoid the problem if we can reproduce it.

You can use the following as a base for your reproducer: https://github.com/gradle/gradle-issue-reproducer

This issue will be closed after 7 days, unless you can provide more information.

Your declaration should be classpath(platform(<GAV>)).

@Meijuh
Copy link
Author

Meijuh commented Sep 2, 2022

I can confirm classpath(platform(<GAV>)) works indeed. It would have helped me if this information is added to page https://docs.gradle.org/current/userguide/plugins.html, is that possible?

Also, is there a similar possibility to add a BOM for plugins to the pluginManagement block?

@jbartok
Copy link
Member

jbartok commented Sep 5, 2022

Pls. give us a concrete example of what you are trying to achieve so that we can check if there is a more suitable way of doing it. Maybe a reproducer where you can expressly point out the expected vs. the current behavior.

@jbartok jbartok self-assigned this Sep 5, 2022
@Meijuh
Copy link
Author

Meijuh commented Sep 9, 2022

I would like to specify a BOM file for plugins that I can use throughout subprojects. So something like the following.

// settings.gradle
pluginManagement {
    repositories {
        gradlePluginPortal()
    }
    plugins {
        platform("group:artifact-bom:1.1.1")
    }
}

And then in any (sub)project I could do either:

// build.gradle
plugins {
  id "org.springframework.boot"
  id "org.flywaydb.flyway"
}

or

// build.gradle
apply plugin: "org.springframework.boot"
apply plugin: "org.flywaydb.flyway"

Where in the above two snippets I do not have to specify plugin versions, as they are read from the BOM in the first snippet.

@jbartok jbartok removed their assignment Sep 12, 2022
@jbartok jbartok removed the to-triage label Sep 12, 2022
@wodead
Copy link

wodead commented Nov 4, 2022

I would like the enhancement too, so I can centralize the plugin version management.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants