Cannot build native binaries in project generated with Kotlin Multiplatform Wizard

I generated a Desktop multiplatform project with https://kmp.jetbrains.com/ I’m trying to build native binary, I added these to build.gradle.ks

    val nativeTarget = linuxX64("native")
    nativeTarget.apply {
        binaries {
            executable {
                entryPoint = "main"
            }
        }
    }

When syncing after file change I get this error:

:composeApp:nativeMain: Could not resolve org.jetbrains.compose.foundation:foundation:1.6.0.
Required by:
    project :composeApp

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

You can find the code here Kotlin-Multiplatform-Wizard-Desktop/composeApp/build.gradle.kts at main · radumarias/Kotlin-Multiplatform-Wizard-Desktop · GitHub

There are several repos added as you can see here Kotlin-Multiplatform-Wizard-Desktop/settings.gradle.kts at main · radumarias/Kotlin-Multiplatform-Wizard-Desktop · GitHub

I found this

compose-plugin = "1.6.0"

here Kotlin-Multiplatform-Wizard-Desktop/gradle/libs.versions.toml at main · radumarias/Kotlin-Multiplatform-Wizard-Desktop · GitHub I tried with other versions too, getting error for new version also.

How can I build the native binary? Or at least how can I create a jar that I can run with java -jar?

1 Like

If you wanna create a Jar, you can use the Gradle Shadow plugin to create a shaded/fat/uber/whatever-you-call-it jar, that will have all your dependencies bundled inside it. Then you can tell Java to run that Jar file.

For the native code, I have no idea, sorry.