Skip to content

Repository files navigation

Compress/Uncompress Maven Plugins

Build Status Java 8 License Maven Central

Maven plugins to compress and uncompress various archive formats.

There are 3 plugins available:

  1. com.evolvedbinary.maven.plugins:compress-uncompress-maven-plugin
  2. com.evolvedbinary.maven.plugins:compress-maven-plugin
  3. com.evolvedbinary.maven.plugins:uncompress-maven-plugin

The first plugin offers both compress and uncompress goals. The other two plugins each offer only compress and uncompress goals respectively. If you are not sure, you probably want he first plugin, the other two plugins are a courtesy to allow you to separate the compress/uncompress tasks for easier reading within your pom.xml if you prefer.

Example Uncompression Use

For example if you wanted to unzip the file src/main/resources/folder1.zip to the folder target/folder1:

<plugin>
    <groupId>com.evolvedbinary.maven.plugins</groupId>
    <artifactId>compress-uncompress-maven-plugin</artifactId>
    <version>1.0.0</version>
    <executions>
        <execution>
            <id>uncompress-zip</id>
            <phase>generate-resources</phase>
            <goals>
                <goal>uncompress</goal>
            </goals>
            <configuration>
                <inputFile>${project.basedir}/src/main/resources/folder1.zip</inputFile>
                <outputPath>${project.build.directory}/folder1</outputPath>
                <algorithm>zip</algorithm>
            </configuration>
        </execution>
    </executions>
</plugin>

Example Compression Use

For example if you wanted to zip the folder src/main/resources/folder1 into the file target/folder1.zip:

<plugin>
    <groupId>com.evolvedbinary.maven.plugins</groupId>
    <artifactId>compress-uncompress-maven-plugin</artifactId>
    <version>1.0.0</version>
    <executions>
        <execution>
            <id>compress-dir-zip</id>
            <phase>generate-resources</phase>
            <goals>
                <goal>compress</goal>
            </goals>
            <configuration>
                <inputPath>${project.basedir}/src/main/resources/folder1</inputPath>
                <outputPath>${project.build.directory}/folder1.zip</outputPath>
                <algorithm>zip</algorithm>
                <compressionLevel>4</compressionLevel>
            </configuration>
        </execution>
    </executions>
</plugin>

Supported Algorithms

  • Zip

If you want to add your own algorithm, you just need to implement com.evolvedbinary.maven.plugins.compressuncompress.common.compression.api.CompressionProvider and/or com.evolvedbinary.maven.plugins.compressuncompress.common.uncompression.api.UncompressionProvider, and make them discoverable to the Java Service Loader. You then make your classes available to the plugin by adding them as a dependency, for example:

<plugin>
    <groupId>com.evolvedbinary.maven.plugins</groupId>
    <artifactId>compress-uncompress-maven-plugin</artifactId>
    <version>1.0.0</version>
    <executions>
        
        ...

    </executions>
    <dependencies>
        <dependency>
            <groupId>com.my.organisation</groupId>
            <artifactId>my-compression-provider</artifactId>
            <version>my-version-number</version>
        </dependency>
    </dependencies>
</plugin>

About

Maven plugins to compress and uncompress various archive formats

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages