views:

666

answers:

1

Hi all,

I've some test resources (that are specific for a particular task) zipped in /test/resources/my.zip.

I want to extract the zip content to /target during the maven's Test Phase.

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

Thanks

+2  A: 

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>
Matt Ryall
thanks Matt! this was very helpful
al nik