Consider the following scenario.
I have a Java 1.8 project that depends on a java 8 artifact called foo-bar
and a java 5 artifact called baz-qux
. baz-qux
also depends on foo-bar
. But it uses the special slimmed down java 5 build called foo-bar-java5
. Thus by including baz-qux
into my project, I transitively bring in foo-bar-java5
. In the end I have an undesirable state where I now have foo-bar
and foo-bar-java5
. Apparently there's no way to do a global exclude. So I can't just exclude foo-bar-java5
. Instead, I must clutter up my cluttered pom and exclude it everywhere it will be pulled in transitively.
With that said, is there any way I can specify that foo-bar
provides foo-bar-java5
? Or is the only option to truly exclude foo-bar-java5
everywhere?