Hi Im trying to run `packageDmg` ```1:11:20 am: Ex...
# compose-desktop
c
Hi Im trying to run
packageDmg
Copy code
1:11:20 am: Executing 'packageDmg --stacktrace'...

> Task :checkRuntime UP-TO-DATE
> Task :createRuntimeImage UP-TO-DATE
> Task :compileKotlinJvm UP-TO-DATE
> Task :compileJava NO-SOURCE
> Task :jvmProcessResources UP-TO-DATE
> Task :jvmMainClasses UP-TO-DATE
> Task :jvmJar UP-TO-DATE
> Task :prepareAppResources NO-SOURCE
> Task :unpackDefaultComposeDesktopJvmApplicationResources UP-TO-DATE
> Task :createDistributable UP-TO-DATE
> Task :packageDmg FAILED
8 actionable tasks: 1 executed, 7 up-to-date

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':packageDmg'.
> External tool execution failed:
  * Command: [/Users/chetangupta/Library/Java/JavaVirtualMachines/temurin-19.0.2/Contents/Home/bin/jpackage, @/Users/chetangupta/Desktop/chetan/compose/desktop/DsaTrainer/build/compose/tmp/packageDmg.args.txt]
  * Working dir: []
  * Exit code: 1
  * Standard output log: /Users/chetangupta/Desktop/chetan/compose/desktop/DsaTrainer/build/compose/logs/packageDmg/jpackage-2023-06-15-01-11-28-out.txt
  * Error log: /Users/chetangupta/Desktop/chetan/compose/desktop/DsaTrainer/build/compose/logs/packageDmg/jpackage-2023-06-15-01-11-28-err.txt
these logs are giving error value
Copy code
WARNING: Using incubator modules: jdk.incubator.jpackage
java.io.IOException: Command [/usr/bin/hdiutil, attach, /var/folders/bt/qz_284cn3218q0rrftztswpc0000gr/T/jdk.incubator.jpackage4311202220842882891/images/DsaTrainer-tmp.dmg, -quiet, -mountroot, /var/folders/bt/qz_284cn3218q0rrftztswpc0000gr/T/jdk.incubator.jpackage4311202220842882891/images] exited with 1 code
I'm using embedded Jdk version openJDK 19.0.2. my gradle contains
Copy code
group = "dev.ch8n"
version = "1.0.1"

compose.desktop {
    application {
        mainClass = "MainKt"
        nativeDistributions {
            targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
            packageName = "DsaTrainer"
            packageVersion = "1.0.1"
            val resourceDirectory = project.layout.projectDirectory.dir("src/jvmMain/resources")
            appResourcesRootDir.set(resourceDirectory)
            includeAllModules = true
            val icon = resourceDirectory.file("images/brain.png")
            macOS {
                iconFile.set(icon)
            }
        }
    }
}
k
Start by using the official jdk distribution and not Temurin to rule that part out
m
Temurin is not the problem. I am using that too and it works. To me it looks as if you have forgotten to eject the DMG drive after an installation attempt which is now blocking the build of a new one. Just a guess from the error message but I once stumbled over that myself too.
c
I will give that a try @Michael Paus.
@Kirill Grouchnikov I tried every jdk version avaiable on IntelliJ nothing worked. @Michael Paus how can i eject DMG cant find anything related to it.
m
When you double-click on a DMG file it gets mounted as a file system like when you insert an USB stick. With the Finder you can eject that. In the past I had the problem that when the DMG file was still mounted, jpackage could not create the same DMG file again. The error message
/usr/bin/hdiutil, attach ...
is hinting in this direction but without knowing more details it is just a guess.
c
@Michael Paus I checked with diskutil list command nothing was mounted still I'm getting error any more suggestion you can provide?
@theapache64 buddy you know anything regarding this
t
@Ch8n Sorry mate. I haven’t tried packaging
dmg
. I use JAR via
packageUberJarForCurrentOS