Maven - extract / test / resources / my.zip inside / target during the testing phase

I have some test resources (specific to a specific task) wired in /test/resources/my.zip .

I want to extract the zip contents to /target during the maven test phase.

Do you know what I have to specify in pom.xml to achieve this?

+4
source share
1 answer

One solution is to use the maven-antrun-plugin to run the unzip Ant task . The following configuration in the build section of your POM should be pretty much what you need (but I haven't tested it):

 <build> <plugins> <!-- ... --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-antrun-plugin</artifactId> <executions> <execution> <phase>process-test-resources</phase> <goals> <goal>run</goal> </goals> <configuration> <tasks> <unzip src="test/resources/my.zip" dest="target/" overwrite="true"/> </tasks> </configuration> </execution> </executions> </plugin> <!-- ... --> </plugins> </build> 
+3
source

All Articles