Skip to main content

Plugin ID

org.jetbrains.compose.hot-reload

Applying the Plugin

Apply the plugin to your Gradle project using the plugins DSL:
build.gradle.kts
plugins {
    id("org.jetbrains.compose.hot-reload") version "<version>"
}
Or using the legacy plugin application:
build.gradle.kts
buildscript {
    dependencies {
        classpath("org.jetbrains.compose.hot-reload:hot-reload-gradle-plugin:<version>")
    }
}

apply(plugin = "org.jetbrains.compose.hot-reload")

Plugin Class

ComposeHotReloadPlugin
Plugin<Project>
Main plugin class that applies Compose Hot Reload functionality to a Gradle project.Package: org.jetbrains.compose.reload.gradleImplementation Class: org.jetbrains.compose.reload.gradle.ComposeHotReloadPlugin

Plugin Dependencies

The plugin requires the following plugins to be present:
Kotlin Plugin
required
The Kotlin Gradle plugin must be applied to the project. The plugin checks for:
  • Kotlin Multiplatform plugin (org.jetbrains.kotlin.multiplatform)
  • Kotlin JVM plugin (org.jetbrains.kotlin.jvm)
Compose Plugin
required
The Compose Multiplatform Gradle plugin must be applied:
  • org.jetbrains.compose

Automatic Configuration

When the plugin is applied, it automatically configures:

Extension

Creates a composeHotReload extension for project-wide configuration.
composeHotReload {
    // Extension configuration
}

Tasks

The plugin automatically registers tasks for each JVM compilation:
hotRun[Target][Compilation]
ComposeHotRun
Run task with hot reload enabled for the compilation.Naming pattern: hotRun + target name + compilation name (if not “main”)Examples:
  • hotRunJvm - for JVM target’s main compilation
  • hotRunDesktop - for Desktop target’s main compilation
hotRun[Target][Compilation]Async
ComposeHotAsyncRun
Async run task that launches the application in a detached process.Examples:
  • hotRunJvmAsync
  • hotRunDesktopAsync
hotReload[Target][Compilation]
ComposeHotReloadTask
Hot reload task that reloads classes for a running application.Examples:
  • hotReloadJvmMain
  • hotReloadDesktopMain
hotSnapshot[Target][Compilation]
ComposeHotSnapshotTask
Takes a snapshot of the classpath for incremental reloading.Examples:
  • hotSnapshotJvmMain
  • hotSnapshotDesktopMain
reload
ComposeHotReloadLifecycleTask
Lifecycle task that hot reloads all running applications.This is the recommended task to use for triggering hot reload.

Compilation Configuration

For each JVM compilation, the plugin:
  1. Enables Compose Compiler with hot reload support
  2. Configures Classpath to include hot reload runtime dependencies
  3. Creates Dev Compilation - A special “dev” compilation associated with main for development
  4. Adds Runtime Dependencies (if enabled via properties):
    • hot-reload-runtime-api
    • Compose Desktop dependencies

Gradle Properties

compose.reload.isHotReloadBuild
boolean
Internal property set when a build is triggered by hot reload.Access via project.isHotReloadBuild property.

Plugin Behavior

The plugin uses a staged initialization process:
  1. PluginApplied Stage - Configures extensions and attributes
  2. EagerConfiguration Stage - Runs when Kotlin plugin is applied
  3. DeferredConfiguration Stage - Runs after project evaluation
This ensures proper collaboration with the Kotlin and Compose plugins.

Requirements

  • JetBrains Runtime (JBR) - Required for hot reload functionality
  • Gradle 7.0+ - Minimum Gradle version
  • Kotlin 1.9.0+ - Minimum Kotlin version
  • Compose Compiler - Must be configured for the project

Task Groups

All hot reload tasks are organized into groups:
  • Compose Hot Reload: Run - Run tasks for launching applications
  • Compose Hot Reload: Other - Reload, snapshot, and utility tasks

Build docs developers (and LLMs) love