gpt4 book ai didi

java - Maven 阴影 : include only specific artifacts and exclude all the rest

转载 作者:行者123 更新时间:2023-11-30 01:42:13 25 4
gpt4 key购买 nike

我正在尝试实现一件非常简单的事情:仅在我的构建中包含一些 Artifact ,同时排除其他所有内容。我不想同时指定包含和排除。

(实际上,我对 Maven Shade 的问题比语法更深入,它还与它的逻辑有关,这让我困惑:我发现双重范式(包含 + 排除)令人困惑,因为对我来说两者都是链接的。)

我已经为此挠头好几个小时了。尽管提供了一些示例here在文档中,我未能找到适用于我的情况的有效语法(我继续获取所有内容,包括我尝试过的任何内容)。
(恕我直言,我发现文档非常简单,而且我找不到该插件的彻底全面的引用。)

我确信有一种方法可以实现这一目标。


<filters>
<filter>
<artifact>**:**</artifact>

<includes>
<include>org/apache/logging/**</include>
</includes>

<excludes>
<exclude>all/the/rest/**</exclude>
</excludes>

</filter>
</filters>

还有:

这个/path/to/artifact 语法是什么? org/apache/logging 是否指的是 Artifact org.apache.logging 还是我弄错了。

最佳答案

我按照评论中的建议使用了以下方法:

     <plugin>

<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>

<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>

<configuration>

#here comes the interesting part
<artifactSet>
<includes>
<include>org.apache.logging.log4j:*</include>
</includes>
</artifactSet>

</configuration>

</execution>
</executions>
</plugin>

关于java - Maven 阴影 : include only specific artifacts and exclude all the rest,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59551818/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com