It seems that including direct dependencies with provided
scope is well understood. It also appears that including transitive dependencies with runtime
scope is also easily accomplished.
But how can I include a dependency two levels of indirection away?
Example:
A --> B --> C
Where A depends on B (compile scope) and B depends on C (provided scope).
I want A
to retrieve C
(eg: download the jar locally), be it via assembly descriptor or maven-dependency-plugin:copy-dependencies
or some other mechanism.
I've tried seemingly every combination of options for both of the aforementioned plugins. Neither approach covers this scenario. They both get B
(even if B
is changed to a provided dependency), and any compile scope dependencies of B
, but not provided dependencies of B.
I suppose that I'm trying to do something similar to a shaded representation of my project but without unpacking dependencies.
Naturally I don't want to have to enumerate all of B's dependencies in A's pom - I'd like to retrieve (and then package) all dependencies implicitly and recursively.
You won't be able to do that. It is not a limitation of the maven-assembly-plugin
, but the way Maven considers transitive dependencies. A transitive dependency that is of scope provided
will be omitted, always (refer to this table in the documentation).
There is an open bug about this (MNG-2205) but I don't think it will be fixed anytime soon. This really is intended behaviour because provided
dependencies, as per the name, as supposed to be provided at runtime.