Closed palto-blubek closed 7 years ago
Gradle used to resolve using Apache Ivy which has this concept. It was the only toggle exposed to filter snapshots in the resolution process. Later Gradle wrote their own resolver and added resolutionStrategy to allow users to reject candidates. That's supported so that you can write one to exclude betas. Maven doesn't have these concepts which is why a milestone is also considered a release.
In the README.md
there's an example using a resolutionStrategy
to do what you want. You can add more qualifiers, e.g. alpha
and preview
.
dependencyUpdates.resolutionStrategy = {
componentSelection { rules ->
rules.all { ComponentSelection selection ->
boolean rejected = ['alpha', 'beta', 'rc', 'cr', 'm'].any { qualifier ->
selection.candidate.version ==~ /(?i).*[.-]${qualifier}[.\d-]*/
}
if (rejected) {
selection.reject('Release candidate')
}
}
}
}
I should have mentioned that I tried the snippet shown in the README.md
but it didn't work - but I now understand, it's just that the regexp was not matching my cases.
I simplified/tweaked it a bit like this, and it works now :)
selection.candidate.version ==~ /.*-${qualifier}.*/
Thanks a lot!
Hi! I am trying to only warn only if "release" (stable) versions of my dependencies exist, and so I use the
-Drevision=release
flag, but I don't see the difference with when I don't use it:There's probably a way to not warn about these alpha / alpha-preview / rc4 versions, but I didn't really understand how.
Thanks a lot!