Multi-Release JAR

The datasketches-memory module assembles a multi-release (MR) JAR for release that consists of multiple Java-release-specific versions of compiled class files.

From JEP-238:

Third party libraries and frameworks typically support a range of Java platform versions, generally going several versions back. As a consequence they often do not take advantage of language or API features available in newer releases since it is difficult to express conditional platform dependencies, which generally involves reflection, or to distribute different library artifacts for different platform versions.

The next case describes the challenge in supporting newer versions of Java for libraries such as DataSketches Memory:

Some libraries and frameworks, furthermore, use internal APIs of the JDK that will be made inaccessible in Java 9 when module boundaries are strictly enforced. This also creates a disincentive to support new platform versions when there are public, supported API replacements for such internal APIs.

Assembly

During the Maven package phase, the Maven exec plugin invokes a custom bash script package-mr-jar.sh located in the tools/scripts directory.
This script requires that the prior phases in the Maven lifecycle have been completed.

The following maven submodules are used to source the compiled class files for the MR-JAR:

MR-JAR maven module mapping

Manifest

The Maven assembly plugin copies version specific class files into JAR manifest META-INF directory, as shown in the diagram below:

MR-JAR manifest file contents