我正在尝试使用 maven 依赖插件解包一个 jar 文件。但是我只想要 jar 文件中的一个文件,并且想要排除 jar 中的 META-INF 目录。我该怎么做?
这是我目前所拥有的:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.0.2</version>
<executions>
<execution>
<id>unpack</id>
<phase>package</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>...</groupId>
<artifactId>...</artifactId>
<version>...</version>
<type>jar</type>
<outputDirectory>${project.basedir}/src/test/</outputDirectory>
<excludes>META-INF</excludes>
</artifactItem>
</artifactItems>
<excludes>META-INF</excludes>
</configuration>
</execution>
</executions>
</plugin>
最佳答案
找到解决方案。
<artifactItem>
<groupId>...</groupId>
<artifactId>...</artifactId>
<version>...</version>
<type>jar</type>
<outputDirectory>${project.basedir}/src/test/</outputDirectory>
<excludes>META-INF/</excludes>
</artifactItem>
只需在目录名后添加正斜杠:/
。
关于java - Maven 依赖插件 - 解包 jar 文件时排除目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47024023/