Plugin ID
Applying the Plugin
Apply the plugin to your Gradle project using the plugins DSL:build.gradle.kts
build.gradle.kts
Plugin Class
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.ComposeHotReloadPluginPlugin Dependencies
The plugin requires the following plugins to be present: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)
The Compose Multiplatform Gradle plugin must be applied:
org.jetbrains.compose
Automatic Configuration
When the plugin is applied, it automatically configures:Extension
Creates acomposeHotReload extension for project-wide configuration.
Tasks
The plugin automatically registers tasks for each JVM compilation: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 compilationhotRunDesktop- for Desktop target’s main compilation
Async run task that launches the application in a detached process.Examples:
hotRunJvmAsynchotRunDesktopAsync
Hot reload task that reloads classes for a running application.Examples:
hotReloadJvmMainhotReloadDesktopMain
Takes a snapshot of the classpath for incremental reloading.Examples:
hotSnapshotJvmMainhotSnapshotDesktopMain
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:- Enables Compose Compiler with hot reload support
- Configures Classpath to include hot reload runtime dependencies
- Creates Dev Compilation - A special “dev” compilation associated with main for development
- Adds Runtime Dependencies (if enabled via properties):
hot-reload-runtime-api- Compose Desktop dependencies
Gradle Properties
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:- PluginApplied Stage - Configures extensions and attributes
- EagerConfiguration Stage - Runs when Kotlin plugin is applied
- DeferredConfiguration Stage - Runs after project evaluation
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