maven-dependency-plugin、copy-dependency:排除一些工件 ID 及其依赖项
我只需将一个依赖项及其所有传递依赖项复制到指定文件夹。 我知道我可以使用“excludeArtifactIds”排除工件,但我还需要排除这些工件的传递依赖项,显然“excludeArtifactIds”不这样做。
有办法做到这一点吗?
I need to copy just one dependency and all its transitive dependencies to a specified folder.
I know i can exclude artifacts with "excludeArtifactIds", but I also need to exclude the transitive dependencies of those artifacts, which, apparently "excludeArtifactIds" does not do.
Is there a way of doing this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看来 Maven 依赖插件不是为此设计的,因为它们关闭了 对此功能的一个请求为“WONTFIX”,另一请求 自 2007 年以来一直开放。
但是,您可以使用 maven-assemble-plugin 来完成类似的任务。
下面我附上了两个示例 POM。第一个是依赖项目(您想要复制的项目),它本身具有一个依赖项(例如)。第二个是聚合项目,您将在其中复制其他项目及其依赖项。我还附加了您将用来复制依赖项的程序集描述符文件。
本质上,这将复制第一个项目,并且它是第二个项目的 target/dest (可配置)目录的一个依赖项。
第一个 POM(依赖项目):/sample-dependency/pom.xml
第二个 POM(聚合项目):
/sample-dependency-aggregator/pom.xml 程序集描述符:/sample-dependency-aggregator/src/main/ assembly/default。 XML
It appears that the Maven dependency plugin is not designed for this as they closed one request for this functionality as "WONTFIX" and another request has been OPEN since 2007.
However, you can use the maven-assembly-plugin to accomplish a similar task.
Below I've attached two sample POM's. The first is the dependent project (the one you wanted to copy) which itself has one dependency (for example). The second is the aggregate project where you are copying the other project and it's dependency to. I've also attached the assembly desriptor file that you'll use to copy the dependency.
Essentially, this will copy the first project and it's one dependency to the target/dest (configurable) directory of the second project.
First POM (dependent project): /sample-dependency/pom.xml
Second POM (aggregating project): /sample-dependency-aggregator/pom.xml
Assembly descriptor : /sample-dependency-aggregator/src/main/assembly/default.xml
如何将 excludeTransitive 设置为
真?
How about setting excludeTransitive to
true
?