I can unpack zip file via the maven-dependency plugin, but currently I have the problem that inside that zip file other zip files are include and I need to unpack them as well. How can I do this?
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="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>
Using ANT is not cool any more ;)
http://maven.apache.org/plugins/maven-dependency-plugin/examples/unpacking-artifacts.html
Sample code for unpacking zip (archive.zip) file:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <executions> <execution> <id>unpack</id> <phase>process-resources</phase> <goals> <goal>unpack</goal> </goals> <configuration> <artifactItems> <artifactItem> <groupId>foo</groupId> <artifactId>archive</artifactId> <version>1.0-SNAPSHOT</version> <type>zip</type> </artifactItem> </artifactItems> </configuration> </execution> </executions> </plugin>
File archive.zip should be installed into maven repository first. For example with task Attach artifact org.codehaus.mojo:build-helper-maven-plugin:build-helper:attach-artifact
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With