When to use “optional” dependencies and when to use “provided” scope?

后端 未结 2 1748
情深已故
情深已故 2020-12-14 00:39

Dependencies decorated by true or provided will be ignored when they are dependent tran

2条回答
  •  误落风尘
    2020-12-14 01:00

    A minor difference I'd like to point out is the treatment of optional vs. provided by various plugins that create packages.

    Apparently war plugin will not package optional dependencies, but there is an open bug about it: https://issues.apache.org/jira/browse/MWAR-351

    The assembly plugin doesn't seem to provide any way to filter based on optional status, while it allows you to filter based on scope.

    It seems the same is true for the shade plugin.

    TL;DR if you are not developing a library, but a top-level application provided scope will give you more flexibility.

提交回复
热议问题