[GRADLE-1570] Allow shorthand to replace transitive dependency version with another version Created: 23/May/11 Updated: 01/May/13 Resolved: 01/May/13
Not sure if this is worth the extra API surface area, but it's fairly common to need to exclude a transitive dependency and replace it with a different version of the same dependency. So for example if you depend on library foo, which depends on commons-logging 1.1, and you want to use commons-logging 1.1.1 instead, then it might be nice to be able to do the following:
In terms of API, "replace" would be nice and terse, but maybe "replaceVersion" is more descriptive?
Obviously you can already do this via "exclude" and by then adding a separate dependency on e.g. commons-logging 1.1.1, but this makes the intent explicit – that what you're doing is replacing a transitive dependency's version. Without this explicit syntax, you have to manually add a comment to the build file documenting that the two actions are related in purpose.
Anyway, just an idea. Feel free to shoot it down or refine it or ask more questions.
|Comment by Daniel Gredler [ 07/Feb/12 ]|
Another use case you may want to consider: wanting to replace a transitive dependency with a completely different transitive dependency, e.g. replacing a transitive dependency on commons-logging with a transitive dependency on jcl-over-slf4j.
|Comment by Adam Murdoch [ 01/May/13 ]|
Dependency resolve rules now allow you to do this in a relatively shorthand way.