for `gradle createDistributable` (MacOS) I get: ``...
# compose-desktop
d
for
gradle createDistributable
(MacOS) I get:
Copy code
Invalid JDK: /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/bin/jpackage is not a file! 
Ensure JAVA_HOME or buildSettings.javaHome is set to JDK 14 or newer
do I really need jdk above 11 or just another jdk than adoptopenjdk? also it complains on mac bundleID not present, but I don't get where to put below
macOS
clause in my build.gradle.kts (using latest intellij)
Copy code
macOS {
    bundleID = "com.example-company.example-app"
}
any ideas?
About jdk, are you sure
JAVA_HOME
is configured correctly?
d
no JAVA_HOME set (using jenv)
j
check if the path ends with
/Home
,
/bin/jpackage
should be unnecessary I think
d
$ export JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home $ $JAVA_HOME/bin/java --version openjdk 11.0.10 2021-01-19 $ gradle packageDmg /Users/hoffi/gitRepos/accordDesk/accordDesk + ./gradlew --no-daemon packageDmg
Task frontendui:createDistributable FAILED
FAILURE: Build failed with an exception. * What went wrong: Execution failed for task 'frontendui:createDistributable'.
Invalid JDK: /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/bin/jpackage is not a file!
Ensure JAVA_HOME or buildSettings.javaHome is set to JDK 14 or newer
and using adoptopenjdk 15 I get:
Copy code
> Task :frontend:ui:createDistributable FAILED
WARNING: Using incubator modules: jdk.incubator.jpackage
Bundler Mac Application Image skipped because of a configuration problem: The first number in a CFBundleVersion cannot be zero or negative.
Advice to fix: Set a compatible 'appVersion' or set a 'mac.CFBundleVersion'. Valid versions are one to three integers separated by dots.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':frontend:ui:createDistributable'.
> Process 'command '/Library/Java/JavaVirtualMachines/adoptopenjdk-15.jdk/Contents/Home/bin/jpackage'' finished with non-zero exit value 1
j
the embedded jdk works?
if so, probably adoptopenjdk problem
d
"embedded" meaning the intellij jdk ?
j
yep
d
can't get the gradle createDistrubutable run from intellij also ... same same
does it need to have a jdk > 14 ??? (or is that just a missleading information? should it work with jdk 11 ?)
o
Yes, JDK 14 is required and JDK 15 is preferred
d
but producing java bytecode with compatibility for 11 is ok I guess? (executing the uber jar on a jdk 11)
hmmm, still don't get it working:
Copy code
compose.desktop {
    application {
        mainClass = "com.accorddesk.frontend.ui.MainKt"
        nativeDistributions {
            targetFormats(
                org.jetbrains.compose.desktop.application.dsl.TargetFormat.Dmg
            )
            packageName = "AccordDeskFrontend"
            version = "${rootProject.version}"
            description = "NdaDesk by AccordDesk"
            copyright = "2021 AccordDesk. All rights reserved."
            vendor = "Dirk Hoffmann"

            macOS {
                bundleID = "com.accorddesk.AccordDeskFrontend"
            }
        }
    }
}
Copy code
> Task :frontend:ui:versionsPrint
Gradle version: 6.8.1
javac  version: 15.0.2 (AdoptOpenJDK 15.0.2+7)
versions of core dependencies:
  kotlin-stdlib-jdk8-1.4.21-2
  kotlin-stdlib-jdk7-1.4.21-2
  foundation-desktop-0.3.0-build148
Copy code
WARNING: Using incubator modules: jdk.incubator.jpackage
Bundler Mac Application Image skipped because of a configuration problem: The first number in a CFBundleVersion cannot be zero or negative. 
Advice to fix: Set a compatible 'appVersion' or set a 'mac.CFBundleVersion'. Valid versions are one to three integers separated by dots.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':frontend:ui:createDistributable'.
> Process 'command '/Library/Java/JavaVirtualMachines/adoptopenjdk-15.jdk/Contents/Home/bin/jpackage'' finished with non-zero exit value 1
👀 1
hmm, funnily I get the identical error if I only want to create a windows msi, debian ... (commented out Mac DMG) error stays the same!
Copy code
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)
o
Is your version in format
1.2.3
?
d
Copy code
version = "0.0.1"
o
Would 1.0 work?
d
f... yes
version = "1.0.1" does(!) work
seems Apple has no heart for early stage stuff and just refuses pre 1.0 versions? 🤣 or why is that!?
definitely worth mentioning in the docs ... as I think almost any(!) compose-desktop has a pre 1.0 version nowadays 🙂
last question: what is supposed to happen if I call
packageMsi
or
packageDeb
on my Mac?? I don't see any distributables inside build/compose/binaries
o
nope, only works on Windows and Linux respectively
m
Internally the Compose desktop toolchain just uses the standard
jpackage
utility, which was introduced with JDK 14, which explains why you don’t find it in an older JDK release. For more details it might be useful to have a look at the documentation here: https://docs.oracle.com/en/java/javase/15/jpackage/
d
ah, thanks for the info. you know, I am old ... I started coding with java 1.1.6 and since I switched to kotlin last year, I follow the new features of java > 11 a bit more unenthusiastic, as coding wise a lot of the cool "new java stuff" kotlin already offers ...
m
@Dirk Hoffmann I am older. I started with 1.1.2😉 From a Kotlin perspective the main benefits of newer Java releases are not the language features but the runtime and tooling improvements. See. e.g., jpackage.
d
well, exactly this thread proves that this is a true statement! 🙂
100 Views