1

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?)

Martin Frank
  • 3,445
  • 1
  • 27
  • 47

1 Answers1

1

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.

fkorotkov
  • 348
  • 2
  • 13
  • Thank you very much. Right now I'm already in the weekend. I'll try it out on Monday and accept it if it's working (but I'm sure it will work) – Martin Frank Jun 28 '19 at 13:46
  • Thanks again for pointing out the details concerning a custom docket container. That seems a very good idea. As said I'll try it out on Monday - thank you very very much – Martin Frank Jun 28 '19 at 18:45
  • installing the packages does not solve the problem, i'll look out for the solution with creating a custom docker file – Martin Frank Jul 01 '19 at 06:37
  • thanks @fkorotkov - i had some other issues what prevented me from your solution, but that's what it does it now!!! – Martin Frank Jul 01 '19 at 08:32
  • Great! Could you please then answer your own question for future researchers? – fkorotkov Jul 01 '19 at 12:34