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:
- linuxwith- javafx.platform=linux
- macosxwith- javafx.platform=mac
- windowswith- javafx.platform=win
- And a custom profile javafx.platform.customwithjavafx.platform=${javafx.platform}
With the new architectures supported, and starting JavaFX 17, the parent pom includes the following Maven profiles:
- linux-x86_64with- javafx.platform=linuxor- javafx.platform=linux-monocle
- linux-aarch64with- javafx.platform=linux-aarch64or- javafx.platform=linux-aarch64-monocle
- linux-arm32with- javafx.platform=linux-arm32-monocle
- macosx-x86_64with- javafx.platform=macor- javafx.platform=mac-monocle
- macosx-aarch64with- javafx.platform=mac-aarch64or- javafx.platform=mac-aarch64-monocle
- windows-x86_64with- javafx.platform=winor- javafx.platform=win-monocle
- windows-x86with- javafx.platform=win-x86or- javafx.platform=win-x86-monocle
- And a custom profile javafx.platform.customwithjavafx.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.