Patch Quarkus Gradle Like a Pro With Renovate
Series: Automated Dependency Updates for Micronaut + Gradle with Renovate
TLDR: Renovate cannot automatically update Quarkus gradle plugin dependencies for projects created via Quarkus CLI. The explanation to the version not tracked is relatively simple ...Renovate cannot resolve the packageName and datasource.
Problem Recap (Original Guide for Micronaut)
As covered in detail in the first post of this series
Renovate cannot resolve the packageName and datasource from the gradle.properties
file.
Updating Quarkus
Similar to Micronaut, Quarkus comes with its own Gradle Plugin and CLI to provide an optimal developer experience.
Renovate seems to be able to resolve, track, and update the Quarkus Platform version for Gradle Kotlin DSL projects created via CLI just fine. But the quarkus plugin version is not detected.
Solution
To avoid duplicate content, for more details on this solution, please read the previous post of this series.
One way to extend and customise Renovate is through customManagers
.
By adding our own regex manager, we can tell Renovate how to update the Quarkus plugin.
We define the datasource, registryUrl, depName, depType, and packageName for all */gradle.properties
files of your project, that contains a line of text like quarkusPluginVersion=x.y.z
, matched by a regular expression.
This customManager is to be added to the renovate.json
in your project:
"customManagers": [
{
"customType": "regex",
"datasourceTemplate": "maven",
"registryUrlTemplate": "https://plugins.gradle.org/m2",
"depNameTemplate": "io.quarkus",
"depTypeTemplate": "plugin",
"packageNameTemplate": "io.quarkus:io.quarkus.gradle.plugin",
"fileMatch": ["(^|/)gradle\\.properties"],
"matchStrings": [
"quarkusPluginVersion=(?<currentValue>[\\w+\\.\\-]*)"
]
}
]
=> Et Voil脿!
Example
Again, here's a starter project, originally created via 'CLI', with Renovate enabled:
https://github.com/thriving-dev/quarkus-gradle-renovate-example
The project is automatically kept up-to-date for minor and patch version updates, with automerge enabled.
- You can see the gradle plugin
io.quarkus 3.x.x
tracked in the dependency dashboard (in the newregex
collection). - The closed Renovate bot PRs and commit history proofs everything is working as it should.
Footnote: This blog post was written to work with Quarkus 3.7.x and Gradle 8.
If you're a maintainer or contributor to Open-Source Java libraries, take a look at thriving-dev/java-library-template introduced in September 2023. It ships with a ready to use renovate.json
and setup guide.