Skip to main content

How create zip files with Maven

In some maven projects is important generate a  compressed file, for example to send by email.
So, in this post I will show you how you can generate compressed files using Maven.
In you pom.xml file you need incorporate the maven-assembly-plugin plugin, something like that:



So, as you can see, you need define a bin.xml file in src/assembly/ path, you can define the name and path that you want. Is only mandatory have a specific structure content. That you can see a example below:


That example, permit create zip, tar, tar.gz, tar.bz2. If you want put all dependencies on the compress file, you don't need define includes tag.

More details about maven-assembly-pluginhttp://maven.apache.org/plugins/maven-assembly-plugin



I hope that information is useful for you. Feel free to comment this post.