Restrict artifact versions with gradle versions plugin
When using the Gradle Versions Plugin I sometimes want to cap/restrict versions because things do not line up properly.
E.g. with a (currently) stable Vaadin v23 project I want to stick with Springboot 2.7
(not 3.0, as this brings all the jakarta shenanigans). So you can use
rejectVersionIf
and look into the designated versions.
tasks.named('dependencyUpdates').configure { rejectVersionIf { // stick with Springboot 2.X until Vaadin also switches to Jakarta-packages it.candidate.group=="org.springframework.boot" && !it.candidate.version.startsWith("2.") } }
Sadly we don't have better means to check the versions. Doing versions via strings feels a little bit like banging stones together to make fire.