Nucleus
Packaging & distribution

One DSL, eighteen installers

Declare the desktop distribution formats you need in the Gradle plugin's DSL and build each one the host operating system supports.

Nucleus declares every desktop distribution format in one nucleus { } Gradle block. You choose the formats with targetFormats(...), and a single task builds each one the host operating system can produce. TargetFormat defines 18 formats, covering direct installers, store packages, and plain archives.

Declare the formats

The packaging DSL ships with the Gradle plugin, so there is no separate dependency to add:

build.gradle.kts
plugins {
    id("dev.nucleusframework") version "2.0.7"
}

List the formats you want inside nativeDistributions:

build.gradle.kts
nucleus {
    application {
        mainClass = "com.example.MainKt"

        nativeDistributions {
            targetFormats(
                TargetFormat.Dmg, TargetFormat.Pkg,
                TargetFormat.Exe, TargetFormat.Nsis, TargetFormat.Msi, TargetFormat.AppX,
                TargetFormat.Deb, TargetFormat.Rpm, TargetFormat.AppImage, TargetFormat.Pacman,
                TargetFormat.Snap, TargetFormat.Flatpak,
                TargetFormat.Zip,
            )
            packageName = "MyApp"
            packageVersion = "1.0.0"
        }
    }
}

Build the installers

./gradlew packageDistributionForCurrentOS

Every format requested for the host operating system is written under build/compose/binaries/.

Formats the host operating system cannot produce are skipped silently. The same build script runs unchanged on macOS, Windows, and Linux, which suits matrix CI.

Supported formats

TargetFormat defines 18 constants. The table groups them by how you ship each build:

OSDirect distributionStoreArchives
macOSDMGPKG (Mac App Store)ZIP, TAR, 7z
WindowsExe, NSIS, MSI, PortableAppX (Microsoft Store)ZIP, TAR, 7z
LinuxDEB, RPM, AppImage, PacmanSnap, FlatpakZIP, TAR, 7z

The full set of enum constants is RawAppImage, Pkg, Deb, Rpm, Dmg, Exe, Msi, Nsis, NsisWeb, Portable, AppX, AppImage, Pacman, Snap, Flatpak, Zip, Tar, and SevenZ. Pass any of them to targetFormats(...). The declaring type is dev.nucleusframework.desktop.application.dsl.TargetFormat.

How it works

Nucleus runs jpackage to produce a platform app-image, then hands that image to electron-builder's --prepackaged mode to drive each installer format. The hybrid keeps jpackage's JVM runtime tuning while using electron-builder for the formats jpackage does not support, such as NSIS, AppX, Snap, Flatpak, and AppImage.

When you mix direct-distribution formats with store formats, Nucleus runs two pipelines: a regular createDistributable for formats like DMG, NSIS, and DEB, and a createSandboxedDistributable for the store formats PKG, AppX, and Flatpak. The sandboxed pipeline pre-extracts native libraries, injects sandbox-aware JVM arguments, and applies the matching entitlements. See Sandboxing.

Configure each platform

Per-OS settings live under nativeDistributions.macOS { }, windows { }, and linux { }:

What's next