Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breaking change when bundling JRE on Mac in 1.2.0+ #125

Closed
2 of 5 tasks
ogerardin opened this issue Sep 9, 2021 · 9 comments
Closed
2 of 5 tasks

Breaking change when bundling JRE on Mac in 1.2.0+ #125

ogerardin opened this issue Sep 9, 2021 · 9 comments

Comments

@ogerardin
Copy link
Contributor

I'm submitting a…

  • bug report
  • feature request
  • other

Short description of the issue/suggestion:
I'm building on Mac, in my configuration I have:

<bundleJre>true</bundleJre>
<jrePath>/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre</jrePath>

which is a valid JRE.

In 1.1.0 it works as expected.
In 1.2.0 and later versions, I get an error:

Invalid JRE specified for 'mac' platform: /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre

Starting with 1.5.1 there is a warning before it fails:

Specified jrePath fixed: /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/Contents/Home

This leads me to believe that "/Contents/Home" is appended to the value of jrePath if it doesn't end with /Contents/Home. This might be correct for a JDK but not for a JRE when it is embedded in the JDK. In any case it should be checked if the specified path is a valid JRE (which it is) before trying to fix it.

Steps to reproduce the issue/enhancement:
Use version of plugin 1.2.0 or later

Specify in configuration:

<bundleJre>true</bundleJre>
<jrePath>/Library/Java/JavaVirtualMachines/jdkXXXXXX/Contents/Home/jre</jrePath>

Run mvn package on a Mac

What is the expected behavior?
JRE is bundled successfully as with JavaPackger 1.1.0

What is the current behavior?
Maven build fails with error:

Invalid JRE specified for 'mac' platform: /Library/Java/JavaVirtualMachines/jdkXXXXXX/Contents/Home/jre

Do you have outputs, screenshots, demos or samples which demonstrate the problem or enhancement?
Screenshot 2021-09-09 at 10 45 09

What is the motivation / use case for changing the behavior?
This is a breaking change, it should work as in 1.1.0

Please tell us about your environment:

  • JavaPackager version: 1.2.0+
  • OS version: MacOS 10.15.7
  • JDK version: 1.8.0_121
  • Build tool:
    • Maven
    • Gradle

Other information (e.g. related issues, suggestions how to fix, links for us to have context)

@fvarrui
Copy link
Owner

fvarrui commented Sep 9, 2021

Hi @ogerardin!
Could you send full Maven output, please? However, I'll try to reproduce your issue.
Thanks!

@ogerardin
Copy link
Contributor Author

Hi @ogerardin!
Could you send full Maven output, please? However, I'll try to reproduce your issue.
Thanks!

Sure, here's the output of mvn clean package with version 1.5.1

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] xpman [pom]
[INFO] xpman-api [jar]
[INFO] xpman-fx [jar]
[INFO] xpman-fx-dist [jar]
[INFO]
[INFO] ---------------------< com.ogerardin.xplane:xpman >---------------------
[INFO] Building xpman 1.0-SNAPSHOT [1/4]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ xpman ---
[INFO]
[INFO] --- maven-enforcer-plugin:3.0.0-M3:enforce (enforce-maven) @ xpman ---
[INFO]
[INFO] --- git-commit-id-plugin:4.0.1:revision (get-the-git-infos) @ xpman ---
[INFO] isPomProject is true and skipPoms is true, return
[INFO]
[INFO] -------------------< com.ogerardin.xplane:xpman-api >-------------------
[INFO] Building xpman-api 1.0-SNAPSHOT [2/4]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ xpman-api ---
[INFO] Deleting /Users/olivier/Projects/Java/XPman/xpman-api/target
[INFO]
[INFO] --- maven-enforcer-plugin:3.0.0-M3:enforce (enforce-maven) @ xpman-api ---
[INFO]
[INFO] --- git-commit-id-plugin:4.0.1:revision (get-the-git-infos) @ xpman-api ---
[INFO] dotGitDirectory /Users/olivier/Projects/Java/XPman/.git
[INFO] Collected git.branch with value master
[INFO] Collected git.commit.id.abbrev with value 1c8224a
[INFO] Collected git.build.time with value 2021-09-09T15:09:22+0200
[INFO] Collected git.build.version with value 1.0-SNAPSHOT
[INFO] Collected git.build.host with value Oliviers-MacBook-Pro.local
[INFO] including property git.build.host in results
[INFO] including property git.build.time in results
[INFO] including property git.commit.id.abbrev in results
[INFO] including property git.branch in results
[INFO] including property git.build.version in results
[INFO] Writing properties file to [/Users/olivier/Projects/Java/XPman/xpman-api/target/classes/git.properties] (for module xpman-api)...
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ xpman-api ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ xpman-api ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 88 source files to /Users/olivier/Projects/Java/XPman/xpman-api/target/classes
[INFO] /Users/olivier/Projects/Java/XPman/xpman-api/src/main/java/com/ogerardin/xplane/util/IntrospectionHelper.java: /Users/olivier/Projects/Java/XPman/xpman-api/src/main/java/com/ogerardin/xplane/util/IntrospectionHelper.java uses or overrides a deprecated API.
[INFO] /Users/olivier/Projects/Java/XPman/xpman-api/src/main/java/com/ogerardin/xplane/util/IntrospectionHelper.java: Recompile with -Xlint:deprecation for details.
[INFO] /Users/olivier/Projects/Java/XPman/xpman-api/src/main/java/com/ogerardin/xplane/inspection/Inspections.java: Some input files use unchecked or unsafe operations.
[INFO] /Users/olivier/Projects/Java/XPman/xpman-api/src/main/java/com/ogerardin/xplane/inspection/Inspections.java: Recompile with -Xlint:unchecked for details.
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ xpman-api ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ xpman-api ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 13 source files to /Users/olivier/Projects/Java/XPman/xpman-api/target/test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ xpman-api ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:3.2.0:jar (default-jar) @ xpman-api ---
[INFO] Building jar: /Users/olivier/Projects/Java/XPman/xpman-api/target/xpman-api-1.0-SNAPSHOT.jar
[INFO]
[INFO] -------------------< com.ogerardin.xplane:xpman-fx >--------------------
[INFO] Building xpman-fx 1.0-SNAPSHOT [3/4]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ xpman-fx ---
[INFO] Deleting /Users/olivier/Projects/Java/XPman/xpman-fx/target
[INFO]
[INFO] --- maven-enforcer-plugin:3.0.0-M3:enforce (enforce-maven) @ xpman-fx ---
[INFO]
[INFO] --- git-commit-id-plugin:4.0.1:revision (get-the-git-infos) @ xpman-fx ---
[INFO] dotGitDirectory /Users/olivier/Projects/Java/XPman/.git
[INFO] Collected git.branch with value master
[INFO] Collected git.commit.id.abbrev with value 1c8224a
[INFO] Collected git.build.time with value 2021-09-09T15:09:29+0200
[INFO] Collected git.build.version with value 1.0-SNAPSHOT
[INFO] Collected git.build.host with value Oliviers-MacBook-Pro.local
[INFO] including property git.build.host in results
[INFO] including property git.build.time in results
[INFO] including property git.commit.id.abbrev in results
[INFO] including property git.branch in results
[INFO] including property git.build.version in results
[INFO] Writing properties file to [/Users/olivier/Projects/Java/XPman/xpman-fx/target/classes/git.properties] (for module xpman-fx)...
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ xpman-fx ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 22 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ xpman-fx ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 71 source files to /Users/olivier/Projects/Java/XPman/xpman-fx/target/classes
[INFO] /Users/olivier/Projects/Java/XPman/xpman-fx/src/main/java/com/ogerardin/xpman/XPmanFX.java: Some input files use unchecked or unsafe operations.
[INFO] /Users/olivier/Projects/Java/XPman/xpman-fx/src/main/java/com/ogerardin/xpman/XPmanFX.java: Recompile with -Xlint:unchecked for details.
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ xpman-fx ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ xpman-fx ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 3 source files to /Users/olivier/Projects/Java/XPman/xpman-fx/target/test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ xpman-fx ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:3.2.0:jar (default-jar) @ xpman-fx ---
[INFO] Building jar: /Users/olivier/Projects/Java/XPman/xpman-fx/target/xpman-fx-1.0-SNAPSHOT.jar
[INFO]
[INFO] -----------------< com.ogerardin.xplane:xpman-fx-dist >-----------------
[INFO] Building xpman-fx-dist 1.0-SNAPSHOT [4/4]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ xpman-fx-dist ---
[INFO] Deleting /Users/olivier/Projects/Java/XPman/xpman-fx-dist/target
[INFO]
[INFO] --- maven-enforcer-plugin:3.0.0-M3:enforce (enforce-maven) @ xpman-fx-dist ---
[INFO]
[INFO] --- git-commit-id-plugin:4.0.1:revision (get-the-git-infos) @ xpman-fx-dist ---
[INFO] dotGitDirectory /Users/olivier/Projects/Java/XPman/.git
[INFO] Collected git.branch with value master
[INFO] Collected git.commit.id.abbrev with value 1c8224a
[INFO] Collected git.build.time with value 2021-09-09T15:09:34+0200
[INFO] Collected git.build.version with value 1.0-SNAPSHOT
[INFO] Collected git.build.host with value Oliviers-MacBook-Pro.local
[INFO] including property git.build.host in results
[INFO] including property git.build.time in results
[INFO] including property git.commit.id.abbrev in results
[INFO] including property git.branch in results
[INFO] including property git.build.version in results
[INFO] Writing properties file to [/Users/olivier/Projects/Java/XPman/xpman-fx-dist/target/classes/git.properties] (for module xpman-fx-dist)...
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ xpman-fx-dist ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ xpman-fx-dist ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ xpman-fx-dist ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/olivier/Projects/Java/XPman/xpman-fx-dist/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ xpman-fx-dist ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ xpman-fx-dist ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- exec-maven-plugin:3.0.0:exec (default) @ xpman-fx-dist ---
/Users/olivier/Projects/Java/XPman/xpman-fx-dist/assets/icon.png
/Users/olivier/Projects/Java/XPman/xpman-fx-dist/assets/mac/X-Plane Manager.icns
[INFO]
[INFO] --- maven-jar-plugin:3.2.0:jar (default-jar) @ xpman-fx-dist ---
[INFO] Building jar: /Users/olivier/Projects/Java/XPman/xpman-fx-dist/target/xpman-fx-dist-1.0-SNAPSHOT.jar
[INFO]
[INFO] --- maven-dependency-plugin:3.1.2:unpack (default) @ xpman-fx-dist ---
[INFO] Configured Artifact: com.ogerardin.xplane:xpman-fx:1.0-SNAPSHOT:jar
[INFO] Unpacking /Users/olivier/Projects/Java/XPman/xpman-fx/target/xpman-fx-1.0-SNAPSHOT.jar to /Users/olivier/Projects/Java/XPman/xpman-fx-dist/target with includes "/icon.png" and excludes ""
[INFO]
[INFO] --- spring-boot-maven-plugin:2.3.0.RELEASE:repackage (generate-repackaged-jar) @ xpman-fx-dist ---
[INFO] Attaching repackaged archive /Users/olivier/Projects/Java/XPman/xpman-fx-dist/target/xpman-fx-dist-1.0-SNAPSHOT-repackaged.jar with classifier repackaged
[INFO]
[INFO] --- javapackager:1.5.1:package (default) @ xpman-fx-dist ---
[INFO] Using packager io.github.fvarrui.javapackager.packagers.MacPackager
[INFO] Creating app ...
[INFO] Initializing packager ...
[INFO] PackagerSettings [outputDirectory=/Users/olivier/Projects/Java/XPman/xpman-fx-dist/target, licenseFile=null, iconFile=null, generateInstaller=true, mainClass=org.springframework.boot.loader.JarLauncher, name=X-Plane Manager, displayName=X-Plane Manager, version=1.0-SNAPSHOT, description=Configuration Manager for Laminar Research X-Plane, url=null, administratorRequired=false, organizationName=(c) Olivier Gérardin 2020, organizationUrl=, organizationEmail=null, bundleJre=true, customizedJre=true, jrePath=/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre, jdkPath=/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre, additionalResources=[], modules=[], additionalModules=[], platform=mac, envPath=null, vmArgs=[], runnableJar=/Users/olivier/Projects/Java/XPman/xpman-fx-dist/target/xpman-fx-dist-1.0-SNAPSHOT-repackaged.jar, copyDependencies=false, jreDirectoryName=jre, winConfig=null, linuxConfig=null, macConfig=MacConfig [icnsFile=null, backgroundImage=null, windowWidth=540, windowHeight=360, windowX=10, windowY=60, iconSize=128, textSize=16, iconX=52, iconY=116, appsLinkIconX=360, appsLinkIconY=116, volumeIcon=null, volumeName=null, generateDmg=true, generatePkg=true, relocateJar=true, appId=org.springframework.boot.loader.JarLauncher, developerId=-, entitlements=null], createTarball=false, createZipball=false, extra=null, useResourcesAsWorkingDir=true, assetsDir=/Users/olivier/Projects/Java/XPman/xpman-fx-dist/assets, classpath=null, jreMinVersion=null, manifest=null]
[INFO] Packager initialized!
[INFO]
[INFO] Creating app structure ...
[INFO] App folder created: /Users/olivier/Projects/Java/XPman/xpman-fx-dist/target/X-Plane Manager
[INFO] Assets folder created: /Users/olivier/Projects/Java/XPman/xpman-fx-dist/target/assets
[INFO] App file folder created: /Users/olivier/Projects/Java/XPman/xpman-fx-dist/target/X-Plane Manager/X-Plane Manager.app
[INFO] Contents folder created: /Users/olivier/Projects/Java/XPman/xpman-fx-dist/target/X-Plane Manager/X-Plane Manager.app/Contents
[INFO] Resources folder created: /Users/olivier/Projects/Java/XPman/xpman-fx-dist/target/X-Plane Manager/X-Plane Manager.app/Contents/Resources
[INFO] Java folder created: /Users/olivier/Projects/Java/XPman/xpman-fx-dist/target/X-Plane Manager/X-Plane Manager.app/Contents/Resources/Java
[INFO] MacOS folder created: /Users/olivier/Projects/Java/XPman/xpman-fx-dist/target/X-Plane Manager/X-Plane Manager.app/Contents/MacOS
[INFO] App structure created!
[INFO]
[INFO] Resolving resources ...
[INFO] Trying to resolve license from POM ...
[INFO] License not resolved!
[INFO]
[WARNING] No license file specified
[INFO] Icon file resolved: /Users/olivier/Projects/Java/XPman/xpman-fx-dist/assets/mac/X-Plane Manager.icns
[INFO] Effective additional resources [/Users/olivier/Projects/Java/XPman/xpman-fx-dist/assets/mac/X-Plane Manager.icns]
[INFO] Resources resolved!
[INFO]
[INFO] Copying additional resources
[INFO] Copying file [/Users/olivier/Projects/Java/XPman/xpman-fx-dist/assets/mac/X-Plane Manager.icns] to folder [/Users/olivier/Projects/Java/XPman/xpman-fx-dist/target/X-Plane Manager/X-Plane Manager.app/Contents/Resources]
[INFO] All additional resources copied!
[INFO]
[INFO] Copying all dependencies ...
[INFO] Dependencies copied to null!
[INFO]
[INFO] Using runnable JAR: /Users/olivier/Projects/Java/XPman/xpman-fx-dist/target/xpman-fx-dist-1.0-SNAPSHOT-repackaged.jar
[INFO] Bundling JRE ... with /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre
[INFO] Embedding JRE from /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre
[WARNING] Specified jrePath fixed: /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/Contents/Home
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for xpman 1.0-SNAPSHOT:
[INFO]
[INFO] xpman .............................................. SUCCESS [ 1.250 s]
[INFO] xpman-api .......................................... SUCCESS [ 8.256 s]
[INFO] xpman-fx ........................................... SUCCESS [ 4.301 s]
[INFO] xpman-fx-dist ...................................... FAILURE [ 3.588 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 17.591 s
[INFO] Finished at: 2021-09-09T15:09:37+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.github.fvarrui:javapackager:1.5.1:package (default) on project xpman-fx-dist: Invalid JRE specified for 'mac' platform: /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/Contents/Home -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn -rf :xpman-fx-dist

Process finished with exit code 1

@fvarrui
Copy link
Owner

fvarrui commented Sep 10, 2021

Fixed in issue-125 branch and changes merged into master. I'm going to release v1.6.0, with this and other changes.

Thanks!

@fvarrui
Copy link
Owner

fvarrui commented Sep 10, 2021

JavaPackager v1.6.0 released to Maven Central

@fvarrui fvarrui closed this as completed Sep 10, 2021
@ogerardin
Copy link
Contributor Author

Thanks! Unfortunately it's not available on Maven central yet https://search.maven.org/artifact/io.github.fvarrui/javapackager
Does it usually take that long?

@fvarrui
Copy link
Owner

fvarrui commented Sep 11, 2021

Yes! Sorry ... sometimes it takes a long time.

image

@fvarrui
Copy link
Owner

fvarrui commented Sep 12, 2021

I realized it's released to Maven Central, so the library is available and can be used, but it seems that it's not indexed yet by the search engine 🤷‍♂️

image

@ogerardin
Copy link
Contributor Author

Finally got a chance to test again and it's now working as expected. Thanks!

@fvarrui
Copy link
Owner

fvarrui commented Oct 20, 2021

Great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants