admin管理员组

文章数量:1125051

I want to override a plugin version to test if it behaves correctly with the new version. Is there a way to pass it through the command line?

My settings.gradle.kts:

pluginManagement {
    val myPluginVersion = "0.1.2"
    plugins {
        id("com.example.myplugin") version myPluginVersion
    }
}

It also should be possible for Dependabot to change this version permanently afterward.

I want to override a plugin version to test if it behaves correctly with the new version. Is there a way to pass it through the command line?

My settings.gradle.kts:

pluginManagement {
    val myPluginVersion = "0.1.2"
    plugins {
        id("com.example.myplugin") version myPluginVersion
    }
}

It also should be possible for Dependabot to change this version permanently afterward.

Share Improve this question edited 2 days ago jonrsharpe 122k30 gold badges264 silver badges472 bronze badges asked 2 days ago pixelpixel 26.4k39 gold badges166 silver badges283 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

I would reccommend the following solution:

  1. Have a standard version of that plugin defined in gradle.properties file (some.version=1.0.0).
  2. Read it in the pluginManagement block
// kotlin
pluginManagement {
  val someVersion = extra["some.version"] as String
  println("========================================")
  println("some version is: $someVersion.")
  println("========================================")
}
  1. When necessary, you can change the property version by passing a value to the command line e.g.

./gradlew assemble -Psome.version=2.0.0

本文标签: How to temporarily override plugin version through command line in GradleStack Overflow