如何使用 Maven 为每个操作系统下载 javafx 库?

How to download javafx libraries for each operating system using Maven?

我在 pom.xml 中定义了 javafx 依赖项,但下载的是仅带有清单的 .jars 和用于我的特定 OS - Windows 的 .jars(见图)。

<dependency>
    <groupId>org.openjfx</groupId>
    <artifactId>javafx-controls</artifactId>
    <version>15.0.1</version>
</dependency>
<dependency>
    <groupId>org.openjfx</groupId>
    <artifactId>javafx-graphics</artifactId>
    <version>15.0.1</version>
</dependency>

如何下载其他的?

我想达到什么目的?

我正在尝试创建 3 个包,每个包都包含我的 .jar 应用程序和针对特定操作系统的 javafx 库,这就是为什么我想下载剩余 OS 的 javafx 库(Linux, Mac).

您可以在依赖项中使用 <classifier> 标签
来自 docs:

The classifier distinguishes artifacts that were built from the same POM but differ in content. It is some optional and arbitrary string that - if present - is appended to the artifact name just after the version number.

我的跨平台 JavaFX 应用程序 pom 通常如下所示:

<dependencies>
    <!-- JavaFX - Windows -->
    <dependency>
      <groupId>org.openjfx</groupId>
      <artifactId>javafx-graphics</artifactId>
      <version>11</version>
      <classifier>win</classifier>
    </dependency>
    <dependency>
      <groupId>org.openjfx</groupId>
      <artifactId>javafx-controls</artifactId>
      <version>11</version>
      <classifier>win</classifier>
    </dependency>
    <dependency>
      <groupId>org.openjfx</groupId>
      <artifactId>javafx-fxml</artifactId>
      <version>11</version>
      <classifier>win</classifier>
    </dependency>
    <!-- JavaFX - Linux -->
    <dependency>
      <groupId>org.openjfx</groupId>
      <artifactId>javafx-graphics</artifactId>
      <version>11</version>
      <classifier>linux</classifier>
    </dependency>
    <dependency>
      <groupId>org.openjfx</groupId>
      <artifactId>javafx-controls</artifactId>
      <version>11</version>
      <classifier>linux</classifier>
    </dependency>
    <dependency>
      <groupId>org.openjfx</groupId>
      <artifactId>javafx-fxml</artifactId>
      <version>11</version>
      <classifier>linux</classifier>
    </dependency>
    <!-- JavaFX - Mac -->
    <dependency>
      <groupId>org.openjfx</groupId>
      <artifactId>javafx-graphics</artifactId>
      <version>11</version>
      <classifier>mac</classifier>
    </dependency>
    <dependency>
      <groupId>org.openjfx</groupId>
      <artifactId>javafx-controls</artifactId>
      <version>11</version>
      <classifier>mac</classifier>
    </dependency>
    <dependency>
      <groupId>org.openjfx</groupId>
      <artifactId>javafx-fxml</artifactId>
      <version>11</version>
      <classifier>mac</classifier>
    </dependency>

    <!-- other dependencies -->
</dependencies>