开发者

Can the Maven shade plugin fail the build when there are duplicate classes?

The Maven shade plugin coalesces your project's Java classes along with its dependencies into a single über JAR file. If there is any overlap (e.g. two dependencies contain a class with the same qualified name), it issues a warning and (if I understand correctly) uses the last version of that class that it comes across.

To me this seems a bit too lax; such an overlap could easily cause linkage or other problems at runtime, e.g. when the overlapping classes contain different bytecode.

Is it possible to configure the shade plugin to fail the build when there are overlaps, instead of just issuing a warning? This开发者_开发百科 would be especially useful on a CI server where nobody is watching the log files to see if there are any warnings.


There doesn't seem to be any such option in the plugin. I've logged an issue requesting this (update: and submitted a patch too, which anyone can apply themselves as necessary).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜