Skip to content

Update Your Version Automatically

Asterios Raptis edited this page Apr 30, 2024 · 5 revisions

Update Your Version Automatically With A Gradle Plugin

In the first part of this series, we explored how to utilize a TOML file for version cataloging in Gradle, enhancing project maintainability and consistency across dependencies. Today, we will build on that foundation by introducing an automated approach to keep your dependencies up-to-date using the version-catalog-update-plugin. This tool is especially useful for Java developers looking to streamline their project updates without manual overhead.

Why Use version-catalog-update-plugin?

Maintaining the latest versions of dependencies ensures that your application can leverage the latest features, performance improvements, and critical security patches. However, manually tracking and updating these versions can be tedious and error-prone. The version-catalog-update-plugin automates this process by checking for updates and applying them to your project's version catalog.

Setting Up the Plugin

Before we begin, make sure you have a Gradle project with a version catalog in the TOML format as described in Part 1 of this series.

Step 1: Define the version of the Plugin

[versions]
gradle-plugin-version-catalog-update = "0.8.4"

[plugins]
versionCatalogUpdate = { id = "nl.littlerobots.version-catalog-update", version.ref = "gradle-plugin-version-catalog-update" }

Step 2: Apply the Plugin

As next, you need to include the plugin in your build.gradle file. Add the following lines to the plugins block:

Clone this wiki locally