How to split subdirectories when using maven dependency plugin

There is a jar file with the following structure:

/-- |-dir1 |-file1 |-file2 |-file3 |-dir2 |-dir3 

I set the filter to accept files only from dir1

 <includes>dir1/*</includes> 

it successfully accepts files only from this directory, but in the target directory the copied files are placed in the dir1 directory, how can you remove the path from the files that were copied and leave only the name there. Therefore, file1 will be copied to target/file1 , and not to 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> 
+4
source share
1 answer

I do not know how to do what you want. If I had your problem, I would use the antrun plugin for rebuilding, or I would build another artifact to extract from it.

0
source

All Articles