Reputation: 325
we have around 100 microservice and 10 teams, that develop them. Technology stack is almost the same. When one team wants to use the new version of the plugin, it spends some time to embed it in its project, then some more time to embed it in the remaining 9 of its projects. Then another team wants to use the new version and also spends time. We use a shared BOM, and it’s very cool! but BOM cannot manage plugin versions, so now teams are still wasting time checking plugin and dependency compatibility.
My research only allowed me to develop the following dependency management method: I create a custom plugin(plugin-version). In it, I
1) include shared BOM
2) create a file Version
open class Versions {
val Detekt = "1.2.1"
val Spring = "2.2.4"
}
3) configure the default values for our commands through the reflection for other plugins extensions .
p.plugins.withId("io.gitlab.arturbosch.detekt") {
val deteckt = p.extensions.getByName("detekt")
deteckt::class.memberProperties.first { it.name == "debug" }.let { property ->
if (property is KMutableProperty<*>) {
property.setter.call(deteckt, true)
println("Set property 'debug' on value 'true' in PluginVersion ")
}
}
}
In project i create folder buildSrc in which apply mu custom plugin as dependency. buildSrc/build.kts
dependencies {
implementation("ru.plugin-version:ru.plugin-version.gradle.plugin:1.0.0")
}
and create crutch file PluginVersion.kt
object PluginVersion : my.plugin.Versions()
After this i can use PluginVersion in buildSrc like root/buildSrc
plugins {
kotlin("jvm")
id("io.gitlab.arturbosch.detekt") version PluginVersion.Detekt
}
plus:
minus:
I would be glad if someone talked about a simpler way to control plugin versions or told how to improve the current one (get rid of the PluginVersion.kt class and buildSrc folder)
Upvotes: 3
Views: 302