Jenkins - 使用Mac上的maven构建JavaFX本机安装程序

问题描述 投票:0回答:1

我有问题,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 plugin说:

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

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个回答
0
投票

所以我找到了解决方案--Jenkins提供了自己的JDK。因此,修复程序将JDK组合框设置为(system)。或者在管道脚本中删除“jdk'JDK1.8'”。这个问题是因为复制了Jenkins任务而导致问题的原因。

    tools {
        maven 'M3.5.4'
        jdk 'JDK1.8'  # delete this
    }
© www.soinside.com 2019 - 2024. All rights reserved.