问题
There has been a myriad of articles written about how migrating from using groovy scripts to using Kotlin DSL for Gradle dependency management is an ideal way to manage build scripts among other mentioned advantages.
However, the limitation that I have found is the lack of this Gradle management way or process in highlighting when new versions of the current dependencies are available as was done previously using groovy scripts. The current solutions that I have found include the use of plugins or utilities that scan through your buildSrc folder and provide the updates as comments to the current versions of the libraries. Some of which include the following:
buildSrcVersions
Gradle-versions-plugin
Apart from the few plugins that I have mentioned is there any other efficient methods of checking for dependency updates?
回答1:
I've tested this Gradle Dependencies Update Check Plugin on my Android/Kotlin DSL build (with a separate Versions class with versions definitions) and it works fine for me:
CheckDependencyUpdates Gradle Plugin
(I've also tested that it works with a traditional Groovy-DSL project)
To install the plugin (copied from linked page) add the following to your build.gradle.kts
. Note that I've removed the version number from this as it will, unlike the page I've linked to, get out of date:
plugins {
id("name.remal.check-dependency-updates")
}
To run the update check (copied from gradle tasks
) run the following:
gradle checkDependencyUpdates
You will see an output section similar to the following:
New dependency version: com.android.tools.build:aapt2: 3.6.1-6040484 -> 3.6.3-6040484
New dependency version: com.android.tools.lint:lint-gradle: 26.6.1 -> 26.6.3
来源:https://stackoverflow.com/questions/56951860/kotlin-dsl-build-scripts-dependency-updates