Install snapdir for Java

The org.snapdir:snapdir artifact ships prebuilt native libraries inside the jar, so you get the full snapdir core — the same BLAKE3 walk, manifests, and 64-character snapshot IDs as the CLI — from a single Maven or Gradle dependency, with no Rust toolchain or C compiler in sight.

Install

Maven:

<dependency>
  <groupId>org.snapdir</groupId>
  <artifactId>snapdir</artifactId>
  <version>1.11.0</version>
</dependency>

Gradle:

implementation("org.snapdir:snapdir:1.11.0")

That is the whole install. The jar is prebuilt, zero build tools: it embeds the native libsnapdir_ffi library for linux-x86_64, linux-aarch64, mac-x86_64, and mac-aarch64, and NativeLoader extracts the right one for your platform at runtime. No Rust toolchain, C compiler, or post-install build step is required.

The binding uses the JDK Foreign Function API, which is an incubator module on JDK 17, so run (and compile) with the module enabled:

java --add-modules jdk.incubator.foreign --enable-native-access=ALL-UNNAMED ...

Each release is CI-verified straight from Maven Central on eclipse-temurin:17-jdk.

Platform support

Every binding runs on Linux (glibc and Alpine/musl, x64 and arm64) and macOS; Windows is unsupported, since snapdir is Unix-only.

Platform Supported
Linux glibc (x64 + arm64) yes
Linux musl / Alpine (x64 + arm64) no (planned 1.11.1)
macOS yes
Windows no

The embedded native library is glibc-linked, so — unlike every other snapdir binding — the Java jar is glibc-only today. It will not load on an Alpine or other musl JVM (UnsatisfiedLinkError). Musl support is planned for 1.11.1 (musl build legs plus a libc probe in NativeLoader).

Next