I've just noted that my war contains both woodstox-core-asl-4.4.1.jar
and woodstox-core-5.0.2.jar
. They are two different version of the same library, but the library changed both groupId and artifactId. Furthermore both are included in my war as transitive dependencies by two different modules of my project.
I know that I can use exclusions
to remove the old version of the library but in this case I should also explicitly "include" the new version in case that module would be used alone (that is not with the other one that includes woodstox-core-5.0.2.jar
).
I don't like this solution. Is there any way to declare that woodstox-core
is an alias of woodstox-core-asl
so that Maven includes only one of these jars?
A similar problem affects old Spring 2.x that published both an all-in-one artifact and smaller separated artifacts. However I think that the most common issue is the one related to artifacts that change their groupId and/or artifactId.
There is no way to do this. Maven doesn't understand the concept of aliases. If it did, then that would open the door to a whole other kind of dependency hell.
What you've described -- adding an <exclusion/>
for the <dependency/>
for all dependencies that need it and then explicitly adding a new <dependency/>
for the renamed artifact -- is the only way you can achieve this at the moment.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With