2

How to find newer upgrades on all libraries in gradle. I have the following dependencies in mybuild.gradle file, how do I find out what newer upgrades are available?

testCompile 'org.mockito:mockito-core:1.9.3'
testCompile 'org.hamcrest:hamcrest-all:1.3'
testCompile 'org.jmockit:jmockit:1.18'
Rpj
  • 5,348
  • 16
  • 62
  • 122

3 Answers3

3

Gradle doesn't have an out of the box, but you can use the excellent gradle-versions-plugin

plugins {
  id "com.github.ben-manes.versions" version "0.12.0"
}

and from there on run gradle dependencyUpdates. The plugin also supports results in xml and json in addition to the standard plain text.

judoole
  • 1,382
  • 2
  • 10
  • 20
1

If you are looking for a way to detect the latest version of a dependency, it is not built into Gradle by default. There does appear to be a plugin that can help.

See this post:

How to check if gradle dependency has new version

Community
  • 1
  • 1
pczeus
  • 7,709
  • 4
  • 36
  • 51
0

Gradle uses the same version syntax as ivy.

http://ant.apache.org/ivy/history/latest-milestone/ivyfile/dependency.html#revision

Where you can do something like:

testCompile 'org.jmockit:jmockit:1.+'
pczeus
  • 7,709
  • 4
  • 36
  • 51
  • Will this fail if it is upgraded to a higher major version (say 2.x). I just want to run a command and I want that to tell me that the latest versions are as follows – Rpj Feb 13 '16 at 17:58
  • So you are doing a build. Commonly, you don't want to have your dependencies automatically upgraded, which could create issues with your code if the API changes. The line I provide means you are ok with any version of jmockit v. 1.0 or any other 1. version... 1.5, 1.8, etc. – pczeus Feb 13 '16 at 18:10
  • I am unaware of any built in Grdle function that will print the latest revisions of a dependency, which means it would be polling the repository for all revisions. – pczeus Feb 13 '16 at 18:10