错误的容器:软件包Javafx.util不存在



我正在实现javafx-application,并使用cirrus-ci进行github的连续集成。

这是我的构建 - 配置.cirrus.yml

container:
  image: maven:3.6.1-jdk-8
build_task:
  build_script: mvn clean compile test sonar:sonar

在构建过程中,它在从安装的JDK中查找Javafx Lib时存在问题(这些错误日志线只是示例,还有更多(:

[ERROR] /tmp/cirrus-ci-build/src/main/java/com/github/martinfrank/catansettler/gui/ControllerFactory.java:[4,19] package javafx.util does not exist
[ERROR] /tmp/cirrus-ci-build/src/main/java/com/github/martinfrank/catansettler/gui/alert/GameSetupAlertController.java:[6,28] package javafx.scene.control does not exist

注意:

当然,有了我当地的devenvirnment,它正在工作...

问题:

什么是包含JAVAFX的JDK的正确设置(CIRRUS构建定义(?(还是我在这里做错了什么?(

您需要安装openjfx。您可以这样做:

container:
  image: maven:3.6.1-jdk-8
build_task:
  install_script:
    - apt-get update 
    - apt-get install --no-install-recommends -y openjfx
  build_script: mvn clean compile test sonar:sonar

您还可以考虑将Dockerfile用作CI环境功能,并创建这样的Dockerfile(存储库中的.ci/Dockerfile相对路径(:

FROM maven:3.6.1-jdk-8
RUN apt-get update 
    && apt-get install --no-install-recommends -y openjfx 
    && apt-get clean 
    && rm -f /var/lib/apt/lists

,您在.cirrus.yml中:

build_task:
  container:
    dockerfile: .ci/Dockerfile
  build_script: mvn clean compile test sonar:sonar

这将剥离30-40秒,以执行install脚本。

最新更新