-
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
Support for ignoring deliberately lagging dependencies #830
Comments
Have you considered using a I believe dependency constraints can be used similarly, but are usually better at enforcing minimum a version to avoid known CVEs so might not be appropriate here. I don't think we do a good job in the pinning approach and there may be a few tickets advocating for changes (but it's unclear as contradictory usages). You can also modify the results prior to displaying them by using a custom output formatter. In this example I had a dependency whose maven metadata was incorrect due to a bug on Central, so I wanted to ignore it being flagged as the build exceeding known version. That was later fixed and removed, and in the meantime I rewrote the results being calling the plugin's reporter. wdyt? |
Thanks for the suggestion on configurations.matching { it.name.contains("Lang3Dot0") }.configureEach {
resolutionStrategy {
force("org.apache.commons:commons-lang3:3.0")
}
} To make it less clunky, it could be possible to have a utility API in the version-compatibility-plugin to add a dependency with a corresponding resolution strategy, but I'm not too fond of that idea as it's less Gradle idiomatic. Dependency constraints could also be an option, though it would lead to the same duplication as the I think I would prefer strict dependencies. If I modify the example I linked to, it would read quite nicely if the dependency was specified as As another side note, could it be made more obvious in the report (XML, JSON, etc) which Gradle configuration(s) is lagging behind? This would be beneficial when more complex dependency setups are used, such as ones introduced by the version compatibility plugin. |
I suspect that you could add the resolution strategy automatically. For example, you could add a resolution strategy for each matching configuration namespace and have a resolution rule that queries if the candidate is a direct dependency and rejects if not the current version. This way you don't need to inspect during the build's configuration phase where you might have to rely on
It shouldn't be. We use Configuration.copyRecursive(), rewrite to dynamic dependency versions, add any of the plugin's additional configuration settings, and resolve. The intent is to try and honor your build configuration. The rich version syntax is a little tricky because users have contradictory usages. Typically it is for transitive dependencies to pin or force a minimum version to avoid CVEs, so we have an option to query for new versions of dependency constraints (as the dependency is not explicitly declared). Others use it instead of a resolution strategy's forced dependencies, which is the older and (I think Gradle's preferred) approach. How we should report using constraints is a little unclear at the moment.
I've long wanted this and and was surprised it wasn't ever asked for before. I didn't have a use-case to add it, but it seemed like a nice quality-of-life improvement that could be useful. PRs are welcome if you're so inclined. |
Caveat lector: These two responses are independent and are attempts at addressing the problem from two different viewpoints.
How about a separate report category for constrained/pinned dependencies, where one would be informed that newer versions exist? E.g. "The following dependencies are pinned but have later milestone versions:"?
Do users usually use |
That would probably be better, so it would assume that constraints restrict the reported upgrades and then shows them in a separate category for those who want to upgrade as well. The resolver currently ignores constraints for direct dependencies under the assumption they were only for transitive restrictions, which is what I think users should do but not all will.
I believe the claim is that newer versions might have CVEs and not be vetted by their security audits, so they want repeatable builds using the same versions. In those cases they likely would use dependency locking, but that only pins the current resolved versions so regenerating that noisy lock file could bring in updates. In those cases they might still use |
Using the version-compatibility-gradle-plugin it is possible to set up adapter layers that bridge API incompatibilities between different versions of a provided external dependency. See the following example.
When running the
dependencyUpdates
task, it will indicate that the adapter layers include dependencies with versions that are lagging behind the latest milestones. The problem is that they must lag behind by design.What would be an idiomatic way to ensure that these dependencies aren't reported? I've had a look at excluding given configurations using
filterConfigurations
but that would ignore any other dependencies that actually should be up to date.Please feel free to fork the example repo and play around with it!
The text was updated successfully, but these errors were encountered: