Migrate from Nucleus 2.x to 3.0New
Move a Nucleus 2.x app to 3.0. Move to Compose 1.13, rename the window and tray dependencies and packages, remove the backend choice and the AWT windows, and review the runtime and build changes.
In this tutorial, you'll move a Nucleus 2.x app to 3.0. Fix the compile errors first, then review the runtime and build changes that alter behavior without breaking the build.
Before you start
- Bump the plugin and every
dev.nucleusframeworkartifact to<version>. - Move to Compose Multiplatform 1.13 and Kotlin 2.4.21, and use JDK 17 or later. Nucleus 3.0 ships with Compose 1.13 and does not run on 1.12. See Compatibility.
- If your app uses
decorated-window-jbrordecorated-window-jni, plan time for the AWT removal. It is the largest step.
Review the checklist
Every breaking or behavior change in 3.0, with the step on this page and the feature page.
Compile errors and removed APIs
| Change | What to do | Docs |
|---|---|---|
| Compose Multiplatform 1.12 is not supported. The build fails when Compose resolves to a version older than 1.13. | Apply org.jetbrains.compose 1.13 and remove constraints that pin Compose. Step | Install |
The decorated-window-* artifacts are renamed window-*: decorated-window-tao is window-runtime. Kotlin packages are unchanged. | Rename the dependencies you declare. Step | Modules |
The composenativetray and composenativetray-app artifacts and their dev.nucleusframework.composenativetray packages are gone. The tray is now the tray and tray-app modules, in dev.nucleusframework.tray. | Swap the dependency and the imports. Step | System tray |
WindowPositionProvider.CenteredOnScreen and AlignedToScreen are renamed, as in Compose 1.13. | Use CenteredInScreenBounds and AlignedToScreenAvailableBounds. Step | Window state |
decorated-window-awt, -jbr, -jni deleted. NucleusBackend, LocalNucleusBackend, nucleusApplication(backend = …) and NucleusApplicationScope.backend removed. | Drop the dependency and the backend argument. Step | Windows |
NucleusWindowUnsafe.awtWindow / awtDialog removed. Receiver-less AWT overloads of MaterialDecoratedWindow, MaterialDecoratedDialog, JewelDecoratedWindow, JewelDecoratedDialog removed. | Use unsafe.taoWindow and the NucleusApplicationScope receivers. Step | Toolkits |
Compose Desktop's AWT Window, DialogWindow and Tray are unsupported. SwingPanel and AWT Canvas embedding fail at runtime. | Import Window and DialogWindow from dev.nucleusframework.application, or use DecoratedWindow, DecoratedDialog, HostedWindow / HostedDialog. Use the Nucleus tray module and NativeView. Step | Dialogs and popups |
Compose's androidx.compose.ui.window.v2 types are not accepted. | Import dev.nucleusframework.window.tao.v2 instead. Step | Window state |
NucleusWindowHost.Window takes two new parameters, minimizable and maximizable. | Add them to your themed host. Step | Toolkits |
Pre-release tool window APIs renamed: SatelliteDragKind is WorkspaceDragKind, TabDropGhost.title is TabDropGhost.tab. The family requires an opt-in. | Rename, then opt in to ExperimentalNucleusApi. Step | Tool windows |
TaoMouseButton.OTHER is now 5; 3 and 4 are BACK and FORWARD. | Recompile code that reads raw Tao mouse button codes. | Mouse buttons |
macOS.appStore and TargetFormat.isStoreFormat no longer compile. | Use macOS { pkg { appStore = … } } and ExecutableRuntime.isSandboxed(). Step | macOS packaging |
GitHubProvider(owner, repo, token) no longer compiles. | Drop the token for a public repository, or use PrivateGitHubProvider(owner, repo, token). Step | Auto-update |
TabHoverPreview.nativeLayer removed. | Delete the argument. Open the tab windows with nativePopupLayers = true to let the card hang outside the window. Step | Tabs |
Runtime behavior changes
| Change | What to do | Docs |
|---|---|---|
Cmd+Q and Dock → Quit call every window's onCloseRequest. | Check that your close handlers exit or close. Step | Application |
| Notification, media control, launcher and global hotkey callbacks run on the host UI thread, not the AWT EDT or a native thread. | Remove Swing assumptions in those callbacks. Step | Threading |
Trackpad pinch arrives as PointerEventType.ScaleStart / ScaleChange / ScaleEnd. | Move pinch code to Modifier.transformable or a Scale listener. Step | Trackpad gestures |
macOS trackpad and Windows precision-touchpad scrolling arrive as PanStart / PanMove / PanEnd. | Handle Pan in custom Scroll handlers. Step | Trackpad gestures |
| Single instance is off in dev runs. | Pass enableSingleInstance = true to test it from run. Step | Single instance |
nucleusApplication initializes FileKit with NucleusApp.appId. | Check your FileKit data directory, or opt out. Step | File dialogs |
Windows: a hung event loop logs SEVERE with a thread dump. | Hook the callbacks or mark long work. Step | Application |
| Windows: opaque windows render text with LCD (ClearType) antialiasing. | Update screenshot baselines, or opt out. Step | HiDPI |
| JRE fonts are stripped from jlink runtime images. | Keep them if you draw text through AWT or Swing. Step | Configuration |
| Nucleus JNI libraries ship next to the packaged app, not inside its JARs. | Load them through NativeLibraryLoader, not as resources. Step | Packaging |
Windows NSIS installs keep the runtime and app in versions\<version>\, and installAndRestart updates without closing the app. | Don't build paths from the install root. Call UpdateHandoff.signalReady() if the app shows no Nucleus window. | Auto-update |
ExecutableRuntime.isSandboxed() returns false in an AppX package. | Test ExecutableRuntime.isAppX() to detect AppX. Step | Executable type |
Tray menu labels are literal: & and _ are no longer mnemonics, and a - label is an item, not a separator. | Use Divider() for separators and drop mnemonic markers. Step | Tray menu |
TaoWindow.setOuterPosition throws IllegalArgumentException for NaN, infinite or out-of-range positions (beyond ±1,000,000 dp). | Don't pass sentinels such as Int.MIN_VALUE as a window position. | Window state |
Build and CI changes
| Change | What to do | Docs |
|---|---|---|
| The plugin downloads Node.js for packaging. | Drop setup-node from CI and cache the download. Step | CI/CD |
nucleusOptimization and its lastJdk knob are opt-in. lastJdk downloads OpenJDK 27. | Turn them on if you want them. Step | Performance |
New in 3.0, no action required
| Change | When it matters | Docs |
|---|---|---|
TaoWindow.canPlaceOnScreen and SatelliteScope.isCompositorPlaced report native Wayland placement. | Chrome that reads window positions on Linux. Step | Linux and Wayland |
nucleusApplication(exitProcessOnExit = true) is the default. | Pass false to keep running after the last window. | Application |
-Dnucleus.native.cacheDir and NativeLibraryLoader.cacheDirectory relocate the native library cache. | Fat JARs, IDE runs, distributions built without the plugin. Step | Packaging |
Move to Compose 1.13
Nucleus 3.0 is built against Compose Multiplatform 1.13 internals, so it fails at run time on 1.12
with NoClassDefFoundError or NoSuchMethodError. The plugin checks it at build time instead.
-
Bump the Compose plugin and Kotlin:
build.gradle.kts plugins { - kotlin("jvm") version "2.4.20" - kotlin("plugin.compose") version "2.4.20" - id("org.jetbrains.compose") version "1.12.1" + kotlin("jvm") version "2.4.21" + kotlin("plugin.compose") version "2.4.21" + id("org.jetbrains.compose") version "1.13.0" id("dev.nucleusframework") version "3.0.0" } -
Remove
strictly,forceor BOM constraints that holdorg.jetbrains.compose.ui:ui-desktopbelow 1.13. If one is left, the build fails withNucleus requires Compose Multiplatform 1.13 or newer. -
Bump the libraries that follow Compose, such as Material 3 and Jewel. The Jewel adapter is built against Jewel
0.43.0-263.8311.126. See Jewel.
An org.jetbrains.compose plugin older than 1.13 only logs a warning, because Gradle upgrades the
Compose libraries anyway. Upgrade it all the same: it injects a Compose Hot Reload agent that Tao
does not support.
Rename the window modules
decorated-window-tao is the only window runtime, not one decoration among several, so the
decorated-window-* family is now window-*. Only the Gradle coordinates move: the Kotlin packages
and the imports stay the same.
| Nucleus 2.x | Nucleus 3.0 |
|---|---|
nucleus.decorated-window-tao | nucleus.window-runtime |
nucleus.decorated-window-core | nucleus.window-core |
nucleus.decorated-window-jewel | nucleus.window-jewel |
nucleus.decorated-window-material2 | nucleus.window-material2 |
nucleus.decorated-window-material3 | nucleus.window-material3 |
dependencies {
implementation("dev.nucleusframework:nucleus.nucleus-application:3.0.0")
- implementation("dev.nucleusframework:nucleus.decorated-window-material3:3.0.0")
+ implementation("dev.nucleusframework:nucleus.window-material3:3.0.0")
}An app that only depends on nucleus-application gets window-runtime and window-core
transitively and has nothing to rename. Also rename the modules in version catalogs, dependency
locks, exclude(module = …) rules and GraalVM or ProGuard configuration.
Remove the backend selection
Tao is the only window runtime in 3.0, and nucleus-application brings it along.
-
Remove
decorated-window-jbr,decorated-window-jni,decorated-window-awtanddecorated-window-tao(nowwindow-runtime) from every module's dependencies. -
Drop the
backendargument and theNucleusBackendimport. Delete reads ofLocalNucleusBackendandNucleusApplicationScope.backend, and keep the Tao branch of backend-specific code:-fun main(args: Array<String>) = nucleusApplication(args, backend = NucleusBackend.Tao) { +fun main(args: Array<String>) = nucleusApplication(args) { -
Replace
nucleusWindow.unsafe.awtWindowwithunsafe.taoWindow, orunsafe.taoHandlefor the native handle. CheckNucleusWindowfirst:toFront(),setMinimumSize(),setIcon()andboundsOnScreen()cover most calls. -
Call the Material and Jewel windows and dialogs on a
NucleusApplicationScope, because the receiver-less AWT overloads are gone. InsidenucleusApplication { }nothing changes. Deeper in the composition, read the scope fromLocalNucleusApplicationScope:val scope = LocalNucleusApplicationScope.current scope.MaterialDecoratedWindow(onCloseRequest = onClose, title = "Editor") { EditorContent() }
Replace Compose Desktop windows, dialogs, and tray
Nucleus 3.0 never creates an AWT window, so Compose Desktop's Window, DialogWindow and Tray
fail under nucleusApplication. Swap each for its Nucleus counterpart:
| Compose Desktop (AWT) | Nucleus 3.0 |
|---|---|
Window(…) | Window(…) from dev.nucleusframework.application, DecoratedWindow(…) for a Compose title bar, or HostedWindow(…) in library code |
DialogWindow(…) | DialogWindow(…) from dev.nucleusframework.application, DecoratedDialog(…), or HostedDialog(…) in library code |
Tray(…) from androidx.compose.ui.window | Tray(…) from the Nucleus tray module |
SwingPanel, AWT Canvas | NativeView |
JFileChooser, java.awt.FileDialog | FileKit |
window.window (ComposeWindow) | nucleusWindow and LocalNucleusWindow |
The Nucleus Window and DialogWindow take Compose's parameters, so the import is the only change.
The platform draws their title bar. If a file also imports androidx.compose.ui.window.*, import
dev.nucleusframework.application.Window explicitly, or the call is ambiguous. See
Choose a window kind.
DecoratedWindow and DecoratedDialog take the same onCloseRequest and title arguments, and
draw the title bar in Compose. HostedWindow and HostedDialog wear the toolkit the app provides, so a library does not pick a
look.
For the tray, add dev.nucleusframework:nucleus.tray:3.0.0 and import
dev.nucleusframework.tray.Tray. Its API differs from Compose's Tray, so port the menu with the
tray menu DSL.
AWT classes that don't need a window keep working: BufferedImage, ImageIO, java.awt.Font,
and the AWT clipboard. APIs that need a window or the AWT event loop do not.
Move the tray to the Nucleus tray modules
ComposeNativeTray now lives in Nucleus, split in two modules that share the Nucleus version:
tray(dev.nucleusframework:nucleus.tray): the icon, the native menu and theTray(…)composables. It needs no window runtime, so a daemon or an app without windows can use it.tray-app(dev.nucleusframework:nucleus.tray-app):TrayApp, the icon that toggles a popup anchored to it. It bringstrayandnucleus-application.
-
Replace the dependency:
build.gradle.kts dependencies { - implementation("dev.nucleusframework:composenativetray:<tray-version>") - implementation("dev.nucleusframework:composenativetray-app:<tray-version>") + implementation("dev.nucleusframework:nucleus.tray:3.0.0") + // Only if you use TrayApp + implementation("dev.nucleusframework:nucleus.tray-app:3.0.0") } -
Replace the imports. The
.apisegments are gone andtrayappis nowtray.app:ComposeNativeTray Nucleus 3.0 dev.nucleusframework.composenativetray.tray.api.Traydev.nucleusframework.tray.Traydev.nucleusframework.composenativetray.menu.api.*(Key,KeyShortcut)dev.nucleusframework.tray.menu.*dev.nucleusframework.composenativetray.trayapp.*(TrayApp,rememberTrayAppState)dev.nucleusframework.tray.app.*-import dev.nucleusframework.composenativetray.tray.api.Tray -import dev.nucleusframework.composenativetray.trayapp.TrayApp +import dev.nucleusframework.tray.Tray +import dev.nucleusframework.tray.app.TrayApp -
Check the menu labels. They are shown as written:
&(Windows) and_(Linux) are no longer eaten as mnemonics, and a-label is a plain item. UseDivider()for separators.
Under GNOME, the AppIndicator extension opens the menu on a single click and calls the primary
action on a double click, so a TrayApp popup opens on a double click there. See
System tray.
Switch window state to the Nucleus v2 package
Compose 1.13's window API v2 depends on AWT, so Nucleus ships a copy with the same members.
Change the import of rememberWindowState, WindowState, DialogState, Screen, the geometry
providers and the remember* factories:
-import androidx.compose.ui.window.v2.rememberWindowState
+import dev.nucleusframework.window.tao.v2.rememberWindowStateCompose 1.13 renamed two position providers, and Nucleus follows:
-positionProvider = WindowPositionProvider.CenteredOnScreen,
+positionProvider = WindowPositionProvider.CenteredInScreenBounds,
-positionProvider = WindowPositionProvider.AlignedToScreen(Alignment.TopEnd),
+positionProvider = WindowPositionProvider.AlignedToScreenAvailableBounds(Alignment.TopEnd),The v1 androidx.compose.ui.window.WindowState keeps working. See
Window state.
Update custom window hosts
NucleusWindowHost.Window takes minimizable: Boolean and maximizable: Boolean after
resizable. A themed host must add both and pass them on. They default to true on
DecoratedWindow and HostedWindow, and DecoratedDialog passes false. NucleusDialogHost is
unchanged.
Opt in to the tool window APIs
Satellites, the dock layout and tabs are @ExperimentalNucleusApi at ERROR level. Opt in per
call site or per module:
kotlin {
compilerOptions {
optIn.add("dev.nucleusframework.window.ExperimentalNucleusApi")
}
}If you used a pre-release build, rename SatelliteDragKind to WorkspaceDragKind (it now serves
both workspaces) and dropGhost.title to dropGhost.tab.title.
On native Wayland, the app can neither read nor set window screen positions. Branch on
TaoWindow.canPlaceOnScreen (or SatelliteScope.isCompositorPlaced in a satellite), not on the
compositor name. See Linux and Wayland.
Replace the PKG store flags
A PKG now targets either the Mac App Store or Developer ID. Move the flag into the pkg { } block:
macOS {
- appStore = true
+ pkg { appStore = true } // default; false builds a Developer ID PKG
}In runtime code, replace ExecutableRuntime.isPkg() and isStoreFormat checks with
ExecutableRuntime.isSandboxed(). A Developer ID PKG is not sandboxed, so it can update itself.
See Sandboxing.
Move private repositories to PrivateGitHubProvider
GitHubProvider takes no token in 3.0, so GitHubProvider(owner, repo, token) no longer
compiles. For a public repository, drop the token. For a private repository or a GitHub Enterprise
Server, switch to PrivateGitHubProvider:
-provider = GitHubProvider(owner = "myorg", repo = "myapp", token = token)
+provider = PrivateGitHubProvider(owner = "myorg", repo = "myapp", token = token)Pass host by name. See
Read updates from GitHub Releases.
Update tab hover previews
TabHoverPreview lost its nativeLayer parameter. Delete the argument. The card now opens like
the window's other popups: in the windows TabWindows opens, it draws inside the window, clipped by
it. To let it hang below the window, open the tab windows yourself with nativePopupLayers = true.
See Draw previews.
Review runtime behavior changes
These changes compile without errors. Check each one against your app.
Check your close handlers
On macOS, Cmd+Q and Dock → Quit now call onCloseRequest on every open window, as on Windows and
Linux. A handler that neither calls exitApplication() nor closes its window cancels the quit. A
hide-to-tray handler lets the quit through while NucleusApplicationScope.isQuitting is true.
See Application.
Move native callbacks off the AWT EDT
notification-linux, notification-windows, media-control, launcher-linux and
launcher-macos callbacks run on the host UI thread. Compose state writes keep working. Remove
SwingUtilities.isEventDispatchThread() checks and Swing calls from them. See
Threading.
Handle pinch and pan events
A trackpad pinch or Ctrl+wheel arrives as ScaleStart / ScaleChange / ScaleEnd, which
detectTransformGestures does not see: use Modifier.transformable. On macOS and
on a Windows precision touchpad, scrolling arrives as PanStart / PanMove / PanEnd. Modifier.scrollable handles it,
but a custom Scroll handler must handle Pan too:
when (event.type) {
PointerEventType.Scroll -> offset += change.scrollDelta * stepPx
PointerEventType.PanMove -> offset += change.panOffset
PointerEventType.ScaleChange -> zoom *= change.scaleFactor
}-Dnucleus.tao.trackpadPanEvents=false sends trackpad scrolling as Scroll. See
Trackpad gestures.
Test single instance in dev runs
A second ./gradlew run or IDE launch now starts a separate instance. Packaged builds keep the
lock. To test the forwarding from run, pass nucleusApplication(args, enableSingleInstance = true).
Check the FileKit initialization
When FileKit is on the classpath, nucleusApplication calls FileKit.init(NucleusApp.appId), so
dev runs, packaged apps and native images share one data directory. A FileKit.init call before
nucleusApplication keeps your configuration. Pass initializeFileKit = false to leave FileKit
untouched.
Handle the event-loop watchdog
On Windows, a stuck event loop now logs SEVERE with a thread dump. Show your own UI from the
callbacks, and wrap known long synchronous work so it is not reported:
nucleusApplication(args) {
onUnresponsive { showWaitOrQuit() }
onResponsive { hideWaitOrQuit() }
expectUnresponsive { importHugeProjectSynchronously() }
}-Dnucleus.tao.watchdog=false disables the watchdog.
Review LCD text on Windows
Opaque windows on Windows now render text with ClearType antialiasing, which changes screenshots.
Update your baselines, or opt out with -Dnucleus.text.lcd=false at run time or
-Pnucleus.text.lcd.patch=false at build time.
Keep JRE fonts for AWT text
The jlink runtime image no longer ships the JRE fonts, because Compose draws with its own. If you
render text through AWT or Swing, set stripJreFonts = false in nativeDistributions.
Load Nucleus native libraries through the loader
Packaged apps carry Nucleus JNI libraries next to the app instead of inside the module JARs. Code
that read them as JAR resources must call NativeLibraryLoader.load(…). Your own libraries under
nucleus/native/ stay in their JARs.
Detect AppX with isAppX
An AppX package runs with full trust, so ExecutableRuntime.isSandboxed() now returns false
there. Code that relied on isSandboxed() to detect AppX must test ExecutableRuntime.isAppX().
See Build an AppX or MSIX package.
Update the build and CI
Drop Node.js from CI
The plugin downloads the Node.js that packaging needs. Remove actions/setup-node from your
workflows and add ~/.gradle/nucleus/nodejs to your cache paths. To keep the node on PATH,
set nodejs { autoDownload = false } in nativeDistributions. See CI/CD.
Opt in to the startup pack
nucleusOptimization is off by default. One switch turns on Serial GC, a compact heap, a single
runtime JAR, idle GC and lastJdk (OpenJDK 27). Override single knobs in the block:
nucleus.application {
nucleusOptimization = true
nucleusOptimization { lastJdk = false }
}An explicit javaHome wins over lastJdk. See Performance.
Retest the app
Run the app, then exercise each integration that used to depend on AWT:
- Drag and drop. Rewrite handlers that read AWT
TransferHandlerdata. See Drag and drop. - Deep links.
onDeepLink { uri -> … }is unchanged. - File dialogs and embedded views. Check every FileKit picker and
NativeView. - Window placement on Linux. Wayland compositors ignore absolute positions.
- Quit flows on macOS, and every close handler.
- Packaging. Build each installer format once, and a native image if you ship one.
What's next
- Windows:
nucleusApplication,WindowandDecoratedWindowin 3.0. - System tray: the
trayandtray-appmodules. - Window state: the AWT-free window API v2.
- Tool windows: satellites, docking and tabs.
- Migrate with an AI agent: let an agent apply this checklist.
Last updated on
Modules
Every Nucleus module by platform and category, what nucleus-application brings, and what each module needs.
Migrate from JetBrains Compose Desktop
Move a JetBrains Compose Desktop app to Nucleus. Apply the plugin, rename the DSL block, and replace the AWT windows, dialogs, and tray with their Nucleus equivalents.