Closed koppor closed 3 years ago
Yes, including such an example is a good idea. Thanks!
The error message tells you that you also need to add something like this:
jpackage {
targetPlatformName = "mac"
....
}
I added your code to build.gradle.
Thank you for the quick action taken.
Think, I do not get "multiple". I thought, I could generate three images by one call. It seems that I can create one image for another runtime ("targetPlatformName
"). I also think that currentOS
should be the targetPlatformName
, because if it is packed for Mac OS X. - Do I have a wrong assumption?
On your computer you can generate three images but only one installer.
Images are created by the runtime
task (which uses jlink) in the build/image
directory, while the installer is created by the jpackage
task in the build/jpackage
directory.
In contrast to jlink, jpackage is not able to produce installers for other platforms. That's why you need to specify the targetPlatformName
in the jpackage block. To create an installer for Windows you need to run jpackage on a Windows platform, to create an installer for Linux you need to run jpackage on a Linux platform, and so on.
To create images and installers for my GitHub projects I don't usually use the targetPlatform
method. Instead, I configure GitHub actions such as here to execute the build on different platforms and to upload the resulting artifacts.
@siordache Thank you for your explanation. Then I'll stick with the "traditional" method.
In case you are going to sign your binaries, here a link to our workflow: https://github.com/JabRef/jabref/blob/bb29baeb458e05ba3bf46d24105fbd3f8e097524/.github/workflows/deployment.yml#L98. With that, we do not hit https://bugs.openjdk.java.net/browse/JDK-8251892.
jpackage { targetPlatformName = "mac" }
This throws me the error Could not set unknown property 'targetPlatformName' for task ':jpackage' of type org.beryx.jlink.JPackageTask.
.
Java 16.0.1, Gradle 7.0.2, JLink plugin 2.24.0.
You probably forgot to put it inside the jlink
block:
jlink {
jpackage {
targetPlatformName = "mac"
}
}
I added following to the config (of this repository), but the result is
Since your runtime task is configured to generate images for multiple platforms, you must specify a targetPlatform for your jpackage task.
.