xatok
xatok

Reputation: 1215

How to know if there is a dependency update available when using Gradle Version Catalog?

My project is now using a Version Catalog for all its Gradle modules and now using the type safe declaration of dependencies in its build.gradle files. Sadly, I no longer get any suggestions from the IDE when there is an update available for a specific dependency.

What is the best approach to work out whether there is an update available for any of the dependencies instead of checking manually one by one?

Upvotes: 10

Views: 3946

Answers (2)

abendt
abendt

Reputation: 765

My recommendation is to use the gradle-versions-plugin or the se.ascp.gradle.gradle-versions-filter extension of it. Both add an additional gradle task dependencyUpdates to your project that will tell you which version updates are available.

It works fine in combination with the new versions catalog feature that you mentioned. I am using it too.

Upvotes: 6

Alexis
Alexis

Reputation: 76

If your build.gradle has Maven repositories such as the Maven Central, you can also use MvnCheck. It is a command line tool, which is standalone unlike the gradle-versions-plugin. It works for both Maven and Gradle projects.

Output example:

2 build file(s) found, checking for artifact updates

my-gradle-project\build.gradle
[COMPILE ONLY] com.google.guava:guava 31.0-android -> 31.1-android
1 artifact update(s) available

my-maven-project\pom.xml
[DEPENDENCY] org.apache.commons:commons-lang3 3.10 -> 3.12.0
[BUILD PLUGIN] org.apache.maven.plugins:maven-compiler-plugin 3.10.0 -> 3.11.0
2 artifact update(s) available

2/2 build file(s) checked, 3 artifact update(s) available

Disclaimer: I am the author of MvnCheck.

Upvotes: 0

Related Questions