Compose Multiplatform Desktop JVM support library for building cross-platform desktop applications with declarative UI framework based on Jetpack Compose
—
The Compose Multiplatform Gradle plugin provides the core functionality for configuring Compose projects and managing dependencies.
abstract class ComposePlugin : Plugin<Project> {
override fun apply(project: Project)
}Apply the plugin in your build.gradle.kts:
plugins {
id("org.jetbrains.compose") version "1.8.2"
}abstract class ComposeExtension @Inject constructor(
objects: ObjectFactory,
project: Project
) : ExtensionAware {
@Deprecated("Since Kotlin 2.2.0 Compose Compiler configuration is moved to the \"org.jetbrains.kotlin.plugin.compose\" plugin")
val kotlinCompilerPlugin: Property<String?>
@Deprecated("Since Kotlin 2.2.0 Compose Compiler configuration is moved to the \"org.jetbrains.kotlin.plugin.compose\" plugin")
val kotlinCompilerPluginArgs: ListProperty<String>
@Deprecated("Since Kotlin 2.2.0 Compose Compiler configuration is moved to the \"org.jetbrains.kotlin.plugin.compose\" plugin")
val platformTypes: SetProperty<KotlinPlatformType>
val dependencies: ComposePlugin.Dependencies
}The extension is available as compose in your build script:
compose {
// Configuration options
}class Dependencies(project: Project) {
val desktop: DesktopDependencies
val animation: String
val animationGraphics: String
val foundation: String
val material: String
val material3: String
val material3AdaptiveNavigationSuite: String
val runtime: String
val runtimeSaveable: String
val ui: String
val uiTooling: String
val uiUtil: String
val preview: String
val materialIconsExtended: String
val components: CommonComponentsDependencies
val html: HtmlDependencies
@Deprecated("Use desktop.uiTestJUnit4")
@ExperimentalComposeLibrary
val uiTestJUnit4: String
@ExperimentalComposeLibrary
val uiTest: String
@Deprecated("Use compose.html")
val web: WebDependencies
fun BOM(version: String = ""): String
}object DesktopDependencies {
val components: DesktopComponentsDependencies
val common: String
val linux_x64: String
val linux_arm64: String
val windows_x64: String
val windows_arm64: String
val macos_x64: String
val macos_arm64: String
val uiTestJUnit4: String
val currentOs: String
}object CommonComponentsDependencies {
val resources: String
val uiToolingPreview: String
}object DesktopComponentsDependencies {
@ExperimentalComposeLibrary
val splitPane: String
@ExperimentalComposeLibrary
val animatedImage: String
}object HtmlDependencies {
val core: String
val svg: String
val testUtils: String
}@Deprecated("Use compose.html")
object WebDependencies {
val core: String
val svg: String
val testUtils: String
}dependencies {
implementation(compose.desktop.currentOs)
implementation(compose.material3)
implementation(compose.ui)
implementation(compose.uiTooling)
// Desktop-specific components
implementation(compose.desktop.components.splitPane)
implementation(compose.desktop.components.animatedImage)
// Testing
testImplementation(compose.desktop.uiTestJUnit4)
}dependencies {
// Target specific platforms
implementation(compose.desktop.linux_x64)
implementation(compose.desktop.windows_x64)
implementation(compose.desktop.macos_arm64)
// Or use current OS
implementation(compose.desktop.currentOs)
}fun RepositoryHandler.jetbrainsCompose(): MavenArtifactRepositoryAdd the JetBrains Compose repository:
repositories {
jetbrainsCompose()
mavenCentral()
}fun KotlinDependencyHandler.compose(groupWithArtifact: String): String
fun DependencyHandler.compose(groupWithArtifact: String): StringThese functions create dependency strings with the current Compose version:
dependencies {
implementation(compose("org.jetbrains.compose.material3:material3"))
}Install with Tessl CLI
npx tessl i tessl/maven-org-jetbrains-compose-desktop--desktop-jvm