Travis构建具有JavaFx支持的OpenJDK10

时间:2018-10-23 11:16:02

标签: java javafx travis-ci java-10

由于几天来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

Travis错误: 像javafx.application这样的多个包不存在

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

before_install:
    - sudo apt install -y openjfx

Travis错误:

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

Travis错误:

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

3 个答案:

答案 0 :(得分:1)

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

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

答案 1 :(得分:1)

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

答案 2 :(得分:-1)

由于JavaFX不包含在OpenJDK中,因此您需要适当的OpenJFX设置才能使其工作,并且由于Java 10是EOL(生命周期终止),因此您还应该升级到OpenJDK 11。

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

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