有一个具有以下结构的jar文件:
/--
|-dir1
|-file1
|-file2
|-file3
|-dir2
|-dir3
我将过滤器设置为仅从 dir1 获取文件
<includes>dir1/*</includes>
它仅从该目录成功获取文件,但在目标目录中复制的文件放置在 dir1 中,如何从复制的文件中删除路径并仅保留名称。所以file1
将被复制到target/file1
而不是target/dir1/file1
<build>
<finalName>${project.build.finalName}</finalName>
<plugins>
<plugin>
<inherited>true</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack</id>
<phase>compile</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>groupId</groupId>
<artifactId>artifactId</artifactId>
<version>version</version>
<type>jar</type>
<overWrite>true</overWrite>
<outputDirectory>target/natives</outputDirectory>
<includes>dir1/*</includes>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>