kingluo
kingluo

Reputation: 1781

maven-shade-plugin: how maven shade same class in different jar?

If my project depends on two jars, A and B, which both in turns depends on class foo.bar.FooBar. But they includes different versions of FooBar in their jars, and only work with that specific version, e.g. A depends on FooBar v1, B depends on FooBar v3.

Then when the shade plugin merges A and B into the final fat jar, how maven relocates them to ensure A and B both work?

Upvotes: 1

Views: 336

Answers (1)

Robert Scholte
Robert Scholte

Reputation: 12345

This means you need a shaded version of both A and B first, both with their own relocated version of foo.bar.FooBar. Only this way A will be "recompiled" with its own FooBar version, and so is B. After that you can create a fat jar.

Upvotes: 1

Related Questions