Maven依赖插件 - 解压缩jar文件时排除目录

Kin*_*ere 3 java jar maven

我试图使用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>
Run Code Online (Sandbox Code Playgroud)

Kin*_*ere 5

找到了解决方案.

<artifactItem>
    <groupId>...</groupId>
    <artifactId>...</artifactId>
    <version>...</version>
    <type>jar</type>
    <outputDirectory>${project.basedir}/src/test/</outputDirectory>
    <excludes>META-INF/</excludes>
</artifactItem>
Run Code Online (Sandbox Code Playgroud)

只需/在目录名后添加正斜杠: