Migrating from 3.x to 4.0
Version 4.0 moves Compress4J from io.github.compress4j to com.hominux and also includes API changes made since 3.1.1.
Dependency
Change the group in your build. Maven follows the relocation POM that every 4.x release also publishes at io.github.compress4j:compress4j, but Gradle builds, and automated version bumps that keep the old group, must use the new coordinates explicitly.
implementation("com.hominux:compress4j:YOUR_VERSION")
<dependency>
<groupId>com.hominux</groupId>
<artifactId>compress4j</artifactId>
<version>YOUR_VERSION</version>
</dependency>
Packages
Replace the package prefix io.github.compress4j with com.hominux.compress4j in imports. This applies to every build tool; the relocation does not rewrite imports.
Module name
The JPMS module is now com.hominux.compress4j. Update requires io.github.compress4j; in your module-info.java.
API changes since 3.1.1
-
ArchiveExtractor.nextEntry()returnsOptional<Entry>. Subclasses returnOptional.empty()at the end of an archive instead ofnull. -
Archive APIs no longer take or expose
Optionalfields and parameters.ArchiveCreator.addFile(String, Path, BasicFileAttributes, Optional<FileTime>)is replaced by an overload takingFileTime. -
Custom
ArchiveCreatorsubclasses implement two abstract methods in place ofwriteFileEntry(…, Optional<Path>): a five-argument one for regular files and a six-argument one taking a non-null symlink target. -
The
compress4j-xz-supportcapability is removed. Addorg.tukaani:xzdirectly for the XZ formats; see Additional Formats.
Want to help? Learn how to contribute to the Compress4J docs ›