Kotlin DSL build scripts dependency updates

谁都会走 提交于 2020-05-27 04:10:21

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!