Jaroslav
Jaroslav

Reputation: 917

Jenkins - Build JavaFX native installer with maven on Mac

I have problem with Jenkins building JavaFX native installer with maven on Mac.

My goal is to automatically create native installer of my JavaFX application on Mac (create the *.dmg and *.pkg files).

I have Mac server set-up with Jenkins and am able to build the project via Jenkins task (it gets sources from GIT and calls mvn clean deploy source:jar -e -U -T 1C).

I am also able to build *.pkg native installer manually by calling mvn clean install -f ./javafx-gui/pom.xml -Pbuild-distribution jfx:native from ssh console.

The problem comes when I try to run the above mentioned task (to build the native installer) from Jenkins, where at the end the javafx-maven-plugin:8.8.3:native plugin says:

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.

I have tried to set the environment variables JAVA_HOME, JRE_HOME, JDK_HOME, JAVA_JRE in ~/.bash_profile and to ~/.profile (The variable are set when I relogin - no problem here I suppose).

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/

Apart from this I could not think of anything else to change.

Note: I am not a Mac user, I normally work on Linux

Logfile:

  ...
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

Upvotes: 1

Views: 957

Answers (1)

Jaroslav
Jaroslav

Reputation: 917

So I have found the solution - Jenkins was providing it's own JDK. Therefore the fix was setting the JDK combobox to (system). Or within the pipeline script delete " jdk 'JDK1.8' " . The problem was caused because of copying Jenkins task where this was set and worked..

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

Upvotes: 1

Related Questions