wrong container: package javafx.util does not exist

1.4k Views Asked by At

i'm implementing a JavaFX-Application and use Cirrus-CI for continuous Integragtion for Github.

this is my build-configuration .cirrus.yml:

container:
  image: maven:3.6.1-jdk-8

build_task:
  build_script: mvn clean compile test sonar:sonar

During build it has problems in finding the JavaFX lib from within the installed JDK(these error log lines are just examples, there are many many more):

[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

Note:

of course, with my local DevEnvirnment it's working...

Question:

what's the proper setup (Cirrus Build Definition) which includes a JDK with JavaFx? (or am i doing something complety wrong here?)

1

There are 1 best solutions below

5
On BEST ANSWER

You need to install openjfx. You can do it like this:

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

You can also consider using Dockerfile as a CI environment feature and create a Dockerfile like this (with .ci/Dockerfile relative path in your repository):

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

And you is in your .cirrus.yml:

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

This will strip of 30-40 seconds which takes to execute the install script.