Essentially as the title says, I’m looking to accomplish a slightly relaxed version of ResolutionStrategy.failOnVersionConflict(), where the build only fails on major (not minor or patch) version conflicts, as described in http://semver.org.
There is an ‘Old Forum’ topic with this exact question, but it hasn’t seen any meaningful updates since 2012 and it seems that the capabilities of ResolutionStrategy have been enhanced quite a bit since then…
I’m thinking about a few possible approaches (disclaimer: I am an Android developer with enough gradle knowledge to get by; by no means an expert):
- Use something like eachDependency to compare the target resolved for a particular dependency to the previous resolution of that dependency (by group and name); I’m unsure where to get the latter piece of information, though.
- Write a custom ResolutionStrategy that has this capability, following the pattern of failOnVersionConflict, and then somehow use this ResolutionStrategy instead of the one that gradle uses by default.
Are either of these solutions reasonable? If so, what should I look into next to go down one of these paths? If not, is there another option?