-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exclude spring managed dependencies #453
Comments
I think you could either defer to the end of the configuration phase using Most likely you would want to use afterEvaluate {
dependencyUpdates.resolutionStrategy {
dependencyManagement.managedVersions.each { key, version ->
force "$key:$version"
}
}
} Your sample could be fixed by moving the call to Another approach would be to use an outputFormatter to remove from the results and then call one of the built-ins, like PlainTextReporter. Then those dependencies wouldn't be listed all. Hopefully one of those variants works out. |
Thanks for the suggestion @ben-manes! Like the OP, this has been irritating me for a while. Your suggestion does get a lot closer, but for others' interest, it does have a couple of cases where the results are a bit weird which people might want to be aware of.
implementation 'org.springframework.boot:spring-boot-starter-undertow'
implementation 'org.jboss.xnio:xnio-api'
def isNonStable = { String version ->
def stableKeyword = ['RELEASE', 'FINAL', 'GA'].any { it -> version.toUpperCase().contains(it) }
def regex = /^[0-9,.v-]+(-r)?$/
return !stableKeyword && !(version ==~ regex)
}
afterEvaluate {
dependencyUpdates {
revision = 'release'
resolutionStrategy {
// Excludes from `dependencyUpdates` versions managed by Spring Boot.
if (!project.hasProperty("updatesIncludeManagedVersions")) {
dependencyManagement.managedVersions.each { key, version ->
force "$key:$version"
}
}
componentSelection {
all {
if (isNonStable(it.candidate.version) && !isNonStable(it.currentVersion)) {
reject('Not a stable version')
}
}
}
}
}
} |
Thank you both for the quick responses. |
Thank you @chadlwilson . your proposal helps me alot in gradle kotlin dsl the solution looks like:
An working example can be found here: https://github.com/arolfes/gradle-versions-plugin-spring-boot |
am I correct that this does not exclude |
|
Thanks, I do want to exclude |
You could write a custom report and exclude dependency updates that you don't care about. The plugin will resolve all configurations, though, and does not have an option to exclude particular ones. |
We use your plugin to determine newer versions of libraries in our project. In addition, we use the spring.boot,.framework and its feature to manage dependent libraries.
Unfortunately, your plugin reports newer version of libraries which are managed through the spring.boot.framework. It is a little time consuming to determine which reported lib is manually updateable and which is managed. Therefore, we tried to exclude the managed libs with a component selection rule:
However, at the very first run of the dependency plugin the dependencyManagement.getManagedVersions() returns an empty map. Is there an better or more easier way to exclude managed libraries from the report?
The text was updated successfully, but these errors were encountered: