Search code examples
macosjpackagejava-19

Jpackage 'missing .jpackage.xml file in app-image dir' on jdk19


I have a script which builds my Java application using jpackage for macOS.

First, it generates the app, then it packages it to a DMG file. This used to work with Java 18, but now with the new Java 19 it fails with java.lang.RuntimeException: Error: Missing .jpackage.xml file in app-image dir (/my-project/target/artifact-image). The script is basically like the following:

${java.home}/bin/jpackage --type app-image --input ${copied-none-modular-dependencies} \
  --resource-dir ${project.build.directory}/package --module-path ${copied-modular-dependencies} \
  --add-modules ${app.additional.modules} --module ${app.main.module}/${app.main.class} \
  --dest ${artifact.image.path} --name "My awesome app" --app-version ${project.version} --verbose \
  --mac-package-name "My awesome app" --mac-package-identifier com.example.awesome.app
${java.home}/bin/jpackage --type dmg --app-image ${artifact.image.path} \
  --resource-dir ${project.build.directory}/package --dest ${artifact.output.path} \
  --name "My awesome app" --app-version ${project.version} --verbose

Is this .jpackage.xml file something new? How should it be generated? I cannot find it in the directory indicated by the error...


Solution

  • I've figured it out! My actual problem was not, that the file was not present. I've simply looked at the wrong place. The file was present under /my-project/target/artifact-image/My awesome app.app/Contents/app/.jpackage.xml.

    The root problem was, that the --app-image parameter now should reference the My awesome app.app directory directly and no more (as in Java 18) its parent (in my case /my-project/target/artifact-image).