Travis 构建支持 JavaFx 的 OpenJDK10

Travis build OpenJDK10 with JavaFx support

几天后,travis 不再支持 jdk 选项 oraclejdk10。所以我试着移动到openjdk10。问题是,我需要 JavaFX 支持,并且我收到各种错误消息以尝试使其正常工作:

尝试 1:

language: java

install: true

script: "cd Aggregation; mvn test -B"

sudo: false
jdk:
    - openjdk10

notifications:
  email:
    recipients:
      - junktogo@web.de
    on_success: change
on_failure: always

特拉维斯错误: javafx.application 等多个包不存在

尝试 2(安装 openjfx 包): 我添加了以下部分:

before_install:
    - sudo apt install -y openjfx

特拉维斯错误:

E: Unable to locate package openjfx
The command "sudo apt install -y openjfx" failed and exited with 100 during.

即使添加 sudo apt update,这个问题仍然存在。

尝试 3:

before_install:
    - sudo apt-get build-dep libopenjfx-java
    - sudo apt-get --compile source libopenjfx-java

特拉维斯错误:

E: Unable to locate package libopenjfx-java
The command "sudo apt-get build-dep libopenjfx-java" failed and exited with 100 during.

您需要正确设置 OpenJFX 才能使其正常工作,因为 JavaFX 不包含在 OpenJDK 中,而且您应该升级到 OpenJDK 11,因为 Java 10 已停产(生命周期结束) ).

查看官方文档: https://openjfx.io/

OpenJDK 11: https://jdk.java.net/11/

正如 Jan S. 建议的那样,使用 Maven 依赖项包括 JavaFX 而不是尝试使用 Travis 构建它就可以了。 将如下内容添加到您的 Maven 依赖项部分:

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

Teavis 使用 OpenJDK 8 构建

language: java
dist: bionic
jdk:
  - openjdk8
before_install:
  - sudo apt-get update -q
  - sudo apt install openjfx=8u161-b12-1ubuntu2 libopenjfx-java=8u161-b12-1ubuntu2 libopenjfx-jni=8u161-b12-1ubuntu2
  - chmod +x deploy.sh
after_success:
  - ./deploy.sh