我正在實施一個 JavaFX 應用程序并使用Cirrus-CI為 Github 進行持續集成。這是我的構建配置.cirrus.yml:container:
image: maven:3.6.1-jdk-8build_task:
build_script: mvn clean compile test sonar:sonar在構建期間,它在從已安裝的 JDK 中查找 JavaFX 庫時遇到問題(這些錯誤日志行只是示例,還有更多):[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 構建定義)是什么?(或者我在這里做錯了什么?)
1 回答

BIG陽
TA貢獻1859條經驗 獲得超6個贊
您需要安裝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。
添加回答
舉報
0/150
提交
取消