Jason Thompson
Jason Thompson

Reputation: 4833

How do I tell maven that an artifact has been renamed?

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?

Upvotes: 4

Views: 253

Answers (1)

David Fleeman
David Fleeman

Reputation: 2658

Here is an answer from another question that may work for you:

https://stackoverflow.com/a/9623517/2879838

Basically, explicitly list the foo-bar-java5 as a dependency in your project and list it as provided. This will tell maven not to put that jar into the archive during the build. This should be a lot less messier than excluding it everywhere.

Upvotes: 1

Related Questions