在gradle中,我不使用动态版本,因为这可能导致不确定的版本。所以我这样说我的依赖关系:
compile 'com.squareup.okhttp:okhttp:2.2.0'
但是,如何确定是否有可用的新版本及其编号?
您可以使用gradle-versions-plugin来完成。这个插件提供了一个dependencyUpdates
任务,
显示最新,超过找到的最新版本,已升级或无法解决的项目依赖项的报告。
您需要做的就是通过配置build.script依赖项来应用,如下所示:
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
}
}
并通过以下方式应用插件本身:
apply plugin: 'com.github.ben-manes.versions'
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句