简体   繁体   中英

How to find out which the latest version of any dependency we include in Gradle is?

In gradle I do not use dynamic versions because that could lead to indeterminate builds. So I state my dependencies like so:

compile 'com.squareup.okhttp:okhttp:2.2.0'

However, how do I find out if there is a new version available and what its number is?

You can use a gradle-versions-plugin to do it. This plugin provides a dependencyUpdates task, which

Displays a report of the project dependencies that are up-to-date, exceed the latest version found, have upgrades, or failed to be resolved.

All you need to do, is to apply, by configuration of build.script dependencies, as:

buildscript {
  repositories {
    jcenter()
  }

  dependencies {
    classpath 'com.github.ben-manes:gradle-versions-plugin:0.11.3'
    // classpath 'org.codehaus.groovy:groovy-backports-compat23:2.3.5' // uncomment if you're using Gradle 1.x
  }
}

And applying the plugin itself, with:

apply plugin: 'com.github.ben-manes.versions'

您可以使用此站点搜索您的库最新版本。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM