CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/maven-org-jetbrains-compose-desktop--desktop-jvm

Compose Multiplatform Desktop JVM support library for building cross-platform desktop applications with declarative UI framework based on Jetpack Compose

Pending
Overview
Eval results
Files

Compose Multiplatform Desktop JVM

Compose Multiplatform Desktop JVM provides comprehensive tooling and components for building cross-platform desktop applications using Jetpack Compose on the JVM. This package includes Gradle plugins for application configuration, desktop-specific UI components, resource management, and distribution tools for Windows, macOS, and Linux.

Package Information

  • Package Name: org.jetbrains.compose.desktop:desktop-jvm
  • Package Type: Maven
  • Language: Kotlin
  • Installation: Apply the Compose Multiplatform Gradle plugin

Core Imports

Gradle Plugin (Kotlin DSL):

plugins {
    id("org.jetbrains.compose") version "1.8.2"
}

Gradle Plugin (Groovy DSL):

plugins {
    id 'org.jetbrains.compose' version '1.8.2'
}

Basic Usage

// Apply the plugin
plugins {
    id("org.jetbrains.compose")
    kotlin("jvm")
}

// Configure desktop application
compose.desktop {
    application {
        mainClass = "MainKt"
        
        nativeDistributions {
            targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
            packageName = "MyApp"
            packageVersion = "1.0.0"
        }
    }
}

// Add desktop dependencies
dependencies {
    implementation(compose.desktop.currentOs)
    implementation(compose.material3)
    implementation(compose.ui)
}

Architecture

The Compose Multiplatform Desktop ecosystem consists of several key components:

  • Gradle Plugin: Core plugin providing configuration DSL and task orchestration
  • Desktop Extensions: Configuration APIs for application packaging and distribution
  • Desktop Components: UI components optimized for desktop platforms
  • Resource Management: Tools for bundling and accessing application resources
  • Build Types: Support for debug and release builds with ProGuard integration

Capabilities

Gradle Plugin Configuration

Core plugin functionality for setting up Compose Multiplatform projects.

class ComposePlugin : Plugin<Project>

abstract class ComposeExtension @Inject constructor(
    objects: ObjectFactory,
    project: Project
) : ExtensionAware {
    val dependencies: ComposePlugin.Dependencies
}

Gradle Plugin Configuration

Desktop Application Configuration

Desktop-specific application configuration and distribution settings.

abstract class DesktopExtension @Inject constructor(
    private val objectFactory: ObjectFactory
) : ExtensionAware {
    val application: JvmApplication
    val nativeApplication: NativeApplication
    fun application(fn: Action<JvmApplication>)
    fun nativeApplication(fn: Action<NativeApplication>)
}

Desktop Application Configuration

Desktop Components

Desktop-optimized UI components for enhanced desktop experiences.

// SplitPane component for resizable panels
@ExperimentalSplitPaneApi
@Composable
fun VerticalSplitPane(
    modifier: Modifier = Modifier,
    splitPaneState: SplitPaneState = rememberSplitPaneState(),
    content: SplitPaneScope.() -> Unit
)

// AnimatedImage component for GIF and animated image support
@Composable
fun AnimatedImage(
    animatedImageLoader: AnimatedImageLoader,
    modifier: Modifier = Modifier,
    contentDescription: String? = null
)

Desktop Components

UI Tooling and Preview

Development-time tools for UI preview and testing capabilities.

@Target(AnnotationTarget.FUNCTION)
@Retention(AnnotationRetention.BINARY)
annotation class Preview(
    val name: String = "",
    val group: String = "",
    val apiLevel: Int = -1,
    val widthDp: Int = -1,
    val heightDp: Int = -1,
    val locale: String = "",
    val fontScale: Float = 1f,
    val showSystemUi: Boolean = false,
    val showBackground: Boolean = false,
    val backgroundColor: Long = 0,
    val uiMode: Int = 0,
    val device: String = Devices.DEFAULT
)

UI Tooling and Preview

Resource Management

Tools for managing and bundling application resources.

abstract class ResourcesExtension {
    // Resource configuration options
}

// Resource generation tasks
class GenerateResourceAccessorsTask : DefaultTask()
class PrepareComposeResources : DefaultTask()

Resource Management

Extension Functions

// Repository configuration
fun RepositoryHandler.jetbrainsCompose(): MavenArtifactRepository

// Dependency helpers
fun KotlinDependencyHandler.compose(groupWithArtifact: String): String
fun DependencyHandler.compose(groupWithArtifact: String): String

Types

TargetFormat

enum class TargetFormat(
    internal val id: String,
    internal val targetOS: OS
) {
    AppImage, Deb, Rpm, Dmg, Pkg, Exe, Msi;
    
    val isCompatibleWithCurrentOS: Boolean
    val outputDirName: String
    val fileExt: String
}

Dependency Objects

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 currentOs: String
    val uiTestJUnit4: String
}

object DesktopComponentsDependencies {
    val splitPane: String
    val animatedImage: String
}

object CommonComponentsDependencies {
    val resources: String
    val uiToolingPreview: String
}

Install with Tessl CLI

npx tessl i tessl/maven-org-jetbrains-compose-desktop--desktop-jvm
Workspace
tessl
Visibility
Public
Created
Last updated
Describes
mavenpkg:maven/org.jetbrains.compose.desktop/desktop-jvm@1.8.x