Unpack inner zips in zip with Maven

You can unzip any files using ant task runner plugin:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-antrun-plugin</artifactId>
    <version>1.6</version>
    <executions>
        <execution>
            <id>prepare</id>
            <phase>validate</phase>
            <configuration>
                <tasks>
                    <echo message="prepare phase" />
                    <unzip src="https://stackoverflow.com/questions/3264064/zips/archive.zip" dest="output/" />
                    <unzip src="output/inner.zip" dest="output/" />
                    <unzip dest="output">
                      <fileset dir="archives">
                        <include name="prefix*.zip" />
                      </fileset>
                    </unzip>
                </tasks>
            </configuration>
            <goals>
                <goal>run</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Leave a Comment