包括直接依赖关系和provided范围似乎是很好理解的。 同样看来,包含runtime作用域的传递依赖也很容易实现。
但是,我怎么能包括一个依赖两个层面的间接?
例:
A --> B --> CA取决于B(编译范围),B取决于C(提供的范围)。
我想A检索C (例如:在本地下载jar),通过汇编描述符或maven-dependency-plugin:copy-dependencies或其他机制。
我已经尝试了两种上述插件的看似各种选项组合。 这两种方法都没有涵盖。 它们都得到B (即使B被改变为提供的依赖项),以及B任何编译范围依赖项,但是不提供B依赖项。
我想我正在试图做一些类似于我的项目的阴影表示,但没有解包依赖关系。
当然我不想在A的pom中枚举B的所有依赖关系 - 我想隐式地和递归地检索(然后打包)所有依赖关系。
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 --> CWhere 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.
最满意答案
你将无法做到这一点。 这不是maven-assembly-plugin的限制,而是Maven考虑传递依赖的方式。 始终会省略provided范围的传递依赖(请参阅文档中的此表 )。
有一个关于这个( MNG-2205 )的开放漏洞,但我认为它不会很快被修复。 这实际上是预期的行为,因为按照名称provided依赖关系,应该在运行时提供它们。
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.
更多推荐
发布评论