【问题标题】:Jenkins - Build JavaFX native installer with maven on MacJenkins - 在 Mac 上使用 maven 构建 JavaFX 原生安装程序
【发布时间】:2018-09-11 20:38:36
【问题描述】:

Jenkins 在 Mac 上使用 maven 构建 JavaFX 原生安装程序时遇到问题。

我的目标是在 Mac 上自动创建 JavaFX 应用程序的本机安装程序(创建 *.dmg 和 *.pkg 文件)。

我使用 Jenkins 设置了 Mac 服务器,并且能够通过 Jenkins 任务构建项目(它从 GIT 获取源并调用 mvn clean deploy source:jar -e -U -T 1C)。

我还可以通过 从 ssh 控制台调用 mvn clean install -f ./javafx-gui/pom.xml -Pbuild-distribution jfx:native 手动构建 *.pkg 本机安装程序。

当我尝试从 Jenkins 运行上述任务(构建本机安装程序)时,问题就出现了,最后 javafx-maven-plugin:8.8.3:native 插件说:

10:00:32 [INFO] 由于配置错误“无法确定指定运行时目录中存在哪个 JRE/JDK”而跳过“DMG 安装程序”。

10:00:32 修复建议:将运行时目录指向 JDK/JRE 根目录、该根目录的 Contents/Home 目录或 JDK 的 Contents/Home/jre 目录之一。

我尝试在 ~/.bash_profile~/.profile 中设置环境变量 JAVA_HOME、JRE_HOME、JDK_HOME、JAVA_JRE(该变量是在我设置重新登录 - 我想这里没问题)。

Server009:~ jenkins$ cat .bash_profile
export JAVA_HOME=$(/usr/libexec/java_home)
export JAVA_JRE=/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/
export JDK_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/
export JRE_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/

除此之外,我想不出还有什么可以改变的。

注意:我不是 Mac 用户,我通常在 Linux 上工作

日志文件:

  ...
10:00:32 [INFO] --- javafx-maven-plugin:8.8.3:native (default-cli) @ javafx-gui ---
10:00:32 [INFO] Building Native Installers
10:00:32 [INFO] Add /Users/jenkins/workspace/(Mac) EasyClient dev CreateInstaller/./javafx-gui/target/jfx/app/config.xml file to application resources.
  ...
10:00:32 [INFO] Add /Users/jenkins/workspace/(Mac) EasyClient dev CreateInstaller/./javafx-gui/target/jfx/app/config.xsd file to application resources.
10:00:32 [INFO] Skipping 'Mac Application Image' because of configuration error 'Cannot determine which JRE/JDK exists in the specified runtime directory.'
10:00:32 Advice to fix: Point the runtime directory to one of the JDK/JRE root, the Contents/Home directory of that root, or the Contents/Home/jre directory of the JDK.
10:00:32 [INFO] Skipping 'DMG Installer' because of configuration error 'Cannot determine which JRE/JDK exists in the specified runtime directory.'
10:00:32 Advice to fix: Point the runtime directory to one of the JDK/JRE root, the Contents/Home directory of that root, or the Contents/Home/jre directory of the JDK.
10:00:32 [INFO] Skipping 'PKG Installer' because of configuration error 'Cannot determine which JRE/JDK exists in the specified runtime directory.'
10:00:32 Advice to fix: Point the runtime directory to one of the JDK/JRE root, the Contents/Home directory of that root, or the Contents/Home/jre directory of the JDK.
10:00:32 [INFO] Skipping 'Mac App Store Ready Bundler' because of configuration error 'Cannot determine which JRE/JDK exists in the specified runtime directory.'
10:00:32 Advice to fix: Point the runtime directory to one of the JDK/JRE root, the Contents/Home directory of that root, or the Contents/Home/jre directory of the JDK.
10:00:32 [INFO] Skipping 'WebStart JNLP Bundler' because of configuration error 'No OutFile Specificed'
10:00:32 Advice to fix: Please specify the name of the JNLP Outut file in 'jnlp.outfile'
10:00:32 [INFO] ------------------------------------------------------------------------
10:00:32 [INFO] BUILD SUCCESS
10:00:32 [INFO] ------------------------------------------------------------------------
10:00:32 [INFO] Total time: 5.919 s
10:00:32 [INFO] Finished at: 2018-09-11T10:00:32+02:00
10:00:32 [INFO] ------------------------------------------------------------------------
10:00:32 Finished: SUCCESS

【问题讨论】:

    标签: macos maven jenkins javafx javafx-8


    【解决方案1】:

    所以我找到了解决方案 - Jenkins 提供了它自己的 JDK。因此,修复将 JDK 组合框设置为(system)。或在管道脚本中删除 " jdk 'JDK1.8' " 。 问题是由于复制了设置和工作的 Jenkins 任务造成的..

        tools {
            maven 'M3.5.4'
            jdk 'JDK1.8'  # delete this
        }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-01
      • 2016-11-12
      • 2020-07-17
      • 2016-12-17
      • 2022-01-25
      相关资源
      最近更新 更多