I am not able to build Distributable Packages........
# compose-desktop
s
I am not able to build Distributable Packages..... Error: --module-path is not specified and this runtime image does not contain jmods directory. Usage: jlink <options> --module-path <modulepath> --add-modules <module>[,<module>...] Use --help for a list of possible options Commands Tried:
./gradlew :desktop:packageDeb
./gradlew :desktop:runDistributable
./gradlew :desktop:createDistributable
Running Locally using
./gradlew :desktop:run
works fine!
g
Which version of JVM do you use?
s
@gildor 11
g
I believe you need at least 14
☝️ 1
s
I thought 11 was least , however will try with 14 , however run works fin in 11 just packaging fails because of
jmods directory
........... Will try on 14 and report back
g
run doesn’t build image, it just assemble standard jar and run it on your jvm
It also mentioned in docs:
Copy code
run is used to run an app locally. You need to define a mainClass — an fq-name of a class, containing the main function. Note, that run starts a non-packaged JVM application with full runtime. This is faster and easier to debug, than creating a compact binary image with minified runtime. To run a final binary image, use runDistributable instead.
It uses jpackage, which is available only from Java 14 https://openjdk.java.net/jeps/343
s
@gildor thanks
d
I also noticed that on Mac OS Version is not allowed to start with a 0. (maybe also worth mentioning in the docs!)
s
@gildor tried with java 15 , still same error
d
here's my gradle on mac snippet (also beware to have version not starting with zero, as I mentioned:
Copy code
compose.desktop {
    application {
        mainClass = theMainClass
        nativeDistributions {
            targetFormats(
                org.jetbrains.compose.desktop.application.dsl.TargetFormat.Dmg,
                org.jetbrains.compose.desktop.application.dsl.TargetFormat.Msi,
                org.jetbrains.compose.desktop.application.dsl.TargetFormat.Deb)
            packageName = "AccordDeskFrontend"
            version = "${rootProject.version}" // "${rootProject.version}" // must not start with '0'
            description = "NdaDesk by AccordDesk"
            copyright = "© 2021 AccordDesk. All rights reserved."
            vendor = "Dirk Hoffmann"

            macOS {
                bundleID = "com.accorddesk.AccordDeskFrontend"
            }
        }
    }
}
s
mine is quite simple and close to Intellij Starter template , not much modification while producing packages:
Copy code
import org.jetbrains.compose.compose
import org.jetbrains.compose.desktop.application.dsl.TargetFormat

plugins {
    kotlin("multiplatform")
    id("org.jetbrains.compose")
}

group = "com.shabinder"
version = Versions.versionName

kotlin {
    jvm {
        compilations.all {
            kotlinOptions.jvmTarget = "14"
        }
    }
    sourceSets {
        val jvmMain by getting {
            dependencies {
                implementation(compose.desktop.currentOs)
                implementation(project(":common:database"))
                implementation(project(":common:dependency-injection"))
                implementation(project(":common:compose"))
                implementation(project(":common:root"))
                implementation(Decompose.decompose)
                implementation(Decompose.extensionsCompose)
                implementation(MVIKotlin.mvikotlin)
                implementation(MVIKotlin.mvikotlinMain)
            }
        }
        val jvmTest by getting
    }
}

compose.desktop {
    application {
        mainClass = "MainKt"
        description = "Music Downloader for Spotify, Gaana, Youtube Music."
        nativeDistributions {
            targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
            packageName = "SpotiFlyer"
        }
    }
}
d
nativeDistributions might need a
packageVersion = "1.0.0"
(needs it on Mac, not sure about msi and deb) on mac also a
Copy code
macOS {
        bundleID = "my.group"
    }
193 Views