Reputation: 3558
I am building my JavaFX app using Maven like so:
Dependencies defined in pom.xml:
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>${javafx.version}</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>${javafx.version}</version>
</dependency>
Maven build command:
mvn package -Djavafx.platform=mac
This sets the platform qualifier when cross-platform building. The following Maven classifiers are available:
win,mac,linux
(See https://openjfx.io/openjfx-docs/ 'cross-platform')
Now if I build with the mac classifier, and then try to execute with a aarch64 JRE, this does not work. Apparently the mac classifier specifies the mac x64 architecture which does not fit to the aarch64 JRE.
Can I somehow specify the aarch64 dependency version for mac?
Upvotes: 3
Views: 1234
Reputation: 45476
This question short of answered a similar issue, but it is now a little bit outdated, as macOS AArch64 support was added starting JavaFX 17.
Before JavaFX 17, the javafx.pom
parent pom included these Maven profiles:
linux
with javafx.platform=linux
macosx
with javafx.platform=mac
windows
with javafx.platform=win
javafx.platform.custom
with javafx.platform=${javafx.platform}
With the new architectures supported, and starting JavaFX 17, the parent pom includes the following Maven profiles:
linux-x86_64
with javafx.platform=linux
or javafx.platform=linux-monocle
linux-aarch64
with javafx.platform=linux-aarch64
or javafx.platform=linux-aarch64-monocle
linux-arm32
with javafx.platform=linux-arm32-monocle
macosx-x86_64
with javafx.platform=mac
or javafx.platform=mac-monocle
macosx-aarch64
with javafx.platform=mac-aarch64
or javafx.platform=mac-aarch64-monocle
windows-x86_64
with javafx.platform=win
or javafx.platform=win-monocle
windows-x86
with javafx.platform=win-x86
or javafx.platform=win-x86-monocle
javafx.platform.custom
with javafx.platform=${javafx.platform}
Therefore, if you want to do a cross-platform build that only includes the dependencies for macOS AArch64 you just need:
mvn package -Djavafx.platform=mac-aarch64
Of course, this only applies to the JavaFX artifacts that Gluon publishes to Maven Center, and not for other distributions (JavaFX SDK or bundled within the Java SDK).
Note: These profiles have a monocle
alternative, that can be activated if you include a javafx.monocle
property in your pom:
<javafx.monocle>true</javafx.monocle>
This allow using the JavaFX artifacts with or without monocle (the implementation of the Glass windowing component of JavaFX for embedded systems), same as if you download the SDK from https://gluonhq.com/products/javafx/. This is useful, for instance, if you run on the command line of a Raspberry Pi without a windows manager.
Upvotes: 5