Plexus Archiver
Collection of Plexus components to create archives or extract archives to a directory with a unified Archiver
/UnArchiver
API whatever the archive format is.
Interface | Components for supported formats (as Plexus role hint) |
---|---|
Archiver |
bzip2 , dir , ear , gzip , jar , mjar , rar (notice produces a jar ), snappy , tar , tar.bz2 (tbz2 ), tar.gz (tgz ), tar.snappy , tar.zst (tzst ), tar.xz (txz ), war , xz , zip , zst |
UnArchiver |
bzip2 , gzip , snappy , tar , tar.bz2 (tbz2 ), tar.gz (tgz ), tar.snappy tar.zst (tzst ), tar.xz (txz ), xz , zip (also available as car , ear , esb , jar , nar , par , rar , sar , swc , war ), zst |
What is Plexus Archiver?
Plexus Archiver is a high-level Java API for creating and extracting archives (ZIP, JAR, TAR, etc.). It provides a simple, unified interface for working with various archive formats, abstracting away the low-level details of archive manipulation.
Comparison to Apache Commons Compress
Plexus Archiver builds on top of Apache Commons Compress (since version 2.5) and provides additional capabilities:
Apache Commons Compress
Commons Compress is a low-level library that provides:
- Direct access to archive formats and compression algorithms
- Fine-grained control over archive entries and their attributes
- Support for a wide range of archive formats (ZIP, TAR, AR, CPIO, etc.)
- Streaming API for memory-efficient processing
Plexus Archiver
Plexus Archiver is a higher-level abstraction layer that adds:
Simplified API: Easy-to-use builder-style interface for common archiving tasks without dealing with low-level stream handling.
Advanced Features:
- File selectors and filtering capabilities
- Automatic handling of file permissions and attributes
- Built-in support for directory scanning with includes/excludes patterns
- Reproducible builds support (configurable timestamps and ordering)
- Duplicate handling strategies
- File mappers for transforming entry names during archiving/unarchiving
- Protection against ZIP bombs (configurable output size limits)
Build Tool Integration: Designed for integration with build tools like Maven, with support for:
- Modular JAR creation (Java 9+ modules)
- Manifest generation and customization
- Archive finalizers for post-processing
Dependency Injection Ready: Includes JSR-330 annotations for easy integration with dependency injection frameworks.
When to Use Which?
Use Apache Commons Compress when:
- You need fine-grained control over archive format details
- You're working with streaming data or large archives
- You need to support specialized or uncommon archive formats
- Memory efficiency is critical
Use Plexus Archiver when:
- You want a simple, declarative API for common archiving tasks
- You're building a Maven plugin or similar build tool
- You need reproducible builds with consistent archive ordering
- You want built-in file filtering and selection capabilities
- You need to create modular JARs or other specialized Java archives