Compose Hot Reload can be configured in multiple ways to suit your project’s needs. This page covers all the configuration options available in your Gradle build scripts.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/JetBrains/compose-hot-reload/llms.txt
Use this file to discover all available pages before exploring further.
Configuring the Main Class
The main class tells Compose Hot Reload which class contains your application’s entry point.Priority Order
Compose Hot Reload uses the following precedence to determine the main class:- Command-line argument:
--mainClass - Gradle property:
-PmainClass=com.example.MainKt - System property:
-Dcompose.mainClass=com.example.MainKt - Compose Multiplatform
application.mainClassconfiguration - Task-specific configuration in build script
In the Compose Desktop Application Block
If you’re using Compose Multiplatform, configure the main class in theapplication block:
build.gradle.kts
In the ComposeHotRun Task
You can also configure the main class directly on hot reload tasks:Via Command Line
Override the main class at runtime:Configuring Run Tasks
You can customize the behavior ofComposeHotRun tasks:
Basic Configuration
build.gradle.kts
Auto Reload Configuration
Enable automatic reload by default:build.gradle.kts
--no-auto.
Resource Directory Configuration
If you’re using Compose desktop resources, you may need to configure the resources directory:build.gradle.kts
Creating Custom Run Tasks
You can create custom run tasks for different configurations:build.gradle.kts
Configuring the JetBrains Runtime
Compose Hot Reload requires the JetBrains Runtime. You can configure how it’s obtained:Automatic JBR Provisioning
Enable automatic JetBrains Runtime download and provisioning:Automatic JBR provisioning is an experimental feature.
- gradle.properties
- Command Line
gradle.properties
Using Gradle Toolchains
Alternatively, use the Gradle toolchain resolver to automatically download JBR:settings.gradle.kts
Manual JBR Path
Specify a custom JBR installation:gradle.properties
System Properties
Compose Hot Reload behavior can be controlled via system properties. You can set these in your build script or pass them at runtime.In Build Script
build.gradle.kts
Via Command Line
Available System Properties
Here are some commonly used system properties:| Property | Description | Default |
|---|---|---|
compose.reload.devToolsEnabled | Enable/disable dev tools window | true |
compose.reload.devToolsDetached | Run dev tools as separate window | false |
compose.reload.devToolsHeadless | Run dev tools without UI | false |
compose.reload.devToolsTransparencyEnabled | Enable transparency effects | true |
compose.reload.reloadEffectsEnabled | Show reload visual effects | true |
compose.reload.logLevel | Set logging level | INFO |
For a complete reference of all system properties, see the System Properties API Reference.
Gradle Properties
You can also configure hot reload using Gradle properties in yourgradle.properties file:
gradle.properties
Multi-Module Configuration
For projects with multiple modules, you can configure hot reload at the root level:build.gradle.kts (root)
build.gradle.kts (root)
Environment-Specific Configuration
You can create environment-specific configurations using Gradle properties:build.gradle.kts
Advanced Configuration
Statics Reinitialization Mode
Control how static variables are handled during hot reload:build.gradle.kts
Virtual Method Resolution
Configure virtual method resolution for advanced hot reload scenarios:build.gradle.kts
Logging Configuration
build.gradle.kts
Configuration Examples
Example 1: Development Setup
build.gradle.kts
Example 2: CI/Headless Environment
build.gradle.kts
Example 3: Multiple Entry Points
build.gradle.kts
Next Steps
- Explore all system properties available for configuration
- Learn about Gradle tasks to see what you can configure
- Check troubleshooting tips if you encounter issues