So Iâve done this, but not yet with OpenJDK (however I will likely need to update our project once funding resumes to switch to OpenJDK).. The challenge with macOS is Gatekeeper. Iâve not checked with current versions of Eclipse or Tycho so they may have been updated since I did this, however at the time the location of the JRE and external directory within the App directory by default does not conform to the structure of a macOS Application Bundle per https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFBundles/BundleTypes/BundleTypes.html#//apple_ref/doc/uid/10000123i-CH101-SW19 The TLDR is if you donât conform to the conventional structure, Gatekeeper sandboxes your application at runtime, and anything not in the conventional locations will not be accessible your application; e.g. things located outside the <appname>.app/Contents/ wonât be accessible - the JRE by default used to get placed in <appname.app>/JRE, so not visible at runtime. Basically the long and short of it is that I located the JRE and external in a place that is located in a permissible location (so I could code sign and run the application later without Gatekeeper complaining or the app just plain failing to start). Then you need to modify the <appname>.ini file to alter the startup arguments to utilize the JRE youâre bundling. One caveat, which was the case I found previously, was that tycho didnât handle the symlink to libjli.dylib correctly, and thus I had to create it. Below is an excerpt from our POM which handles all this JRE packaging - minus the code signingâ You could likely âhand jamâ the procedure to validate that it still works. FWIW: I repackaged the Oracle JRE as a Maven artifact and store it in our private Artifactory to make use of it simpler for us. Hopefully this is helpful <profile> <id>fix-jre-archives</id> <activation> <os><family>unix</family></os> </activation> <dependencies> <dependency> <groupId>com.sri</groupId> <artifactId>oracle-jre</artifactId> <version>${distrib.oracle-jre.version}</version> <classifier>macosx-x64</classifier> <type>tar.gz</type> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <version>2.8</version> <executions> <execution> <id>unpack-mac-jre</id> <phase>prepare-package</phase> <goals> <goal>unpack</goal> </goals> <configuration> <artifactItems> <artifactItem> <groupId>com.sri</groupId> <artifactId>oracle-jre</artifactId> <version>${distrib.oracle-jre.version}</version> <classifier>macosx-x64</classifier> <type>tar.gz</type> <outputDirectory>${distrib.macosx.x86_64}</outputDirectory> </artifactItem> </artifactItems> </configuration> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-antrun-plugin</artifactId> <version>1.7</version> <executions> <execution> <id>fix-jre-mac</id> <phase>package</phase> <goals> <goal>run</goal> </goals> <configuration> <target> <mkdir dir="${distrib.macosx.x86_64}/${distrib.product.name}.app"/> <move file="${distrib.macosx.x86_64}/jre${distrib.jre.version}.jre" tofile="${distrib.macosx.x86_64}/${distrib.product.name}.app/Contents/jre"/> <symlink action="" link="${distrib.macosx.x86_64}/${distrib.product.name}.app/Contents/jre/Contents/MacOS/libjli.dylib" /> <symlink link="${distrib.macosx.x86_64}/${distrib.product.name}.app/Contents/jre/Contents/MacOS/libjli.dylib" resource="../Home/lib/jli/libjli.dylib" overwrite="true"/> <concat destfile="${distrib.macosx.x86_64}/${distrib.product.name}.app/Contents/Eclipse/${distrib.bin.name}_temp.ini" fixlastline="yes"> <header filtering="no" trimleading="yes"> -vm ../jre/Contents/Home/lib/server/libjvm.dylib </header> <fileset file="${distrib.macosx.x86_64}/${distrib.product.name}.app/Contents/Eclipse/${distrib.bin.name}.ini"/> </concat> <move file="${distrib.macosx.x86_64}/${distrib.product.name}.app/Contents/Eclipse/${distrib.bin.name}.ini" tofile="${distrib.macosx.x86_64}/${distrib.product.name}.app/Contents/Eclipse/${distrib.bin.name}_bak.ini" /> <move file="${distrib.macosx.x86_64}/${distrib.product.name}.app/Contents/Eclipse/${distrib.bin.name}_temp.ini" tofile="${distrib.macosx.x86_64}/${distrib.product.name}.app/Contents/Eclipse/${distrib.bin.name}.ini" /> </target> </configuration> </execution> <execution> <id>relocate-external-mac</id> <phase>package</phase> <goals> <goal>run</goal> </goals> <configuration> <target> <mkdir dir="${distrib.macosx.x86_64}/${distrib.product.name}.app/Contents/Sunflower"/> <move file="${distrib.macosx.x86_64}/external" tofile="${distrib.macosx.x86_64}/${distrib.product.name}.app/Contents/Sunflower/external" /> </target> </configuration> </execution> <execution> <id>remove-director-archive-mac</id> <phase>pre-integration-test</phase> <goals> <goal>run</goal> </goals> <configuration> <target> <delete file="${archive.macosx.x86_64}" /> <mkdir dir="${distrib.macosx.x86_64}/${distrib.product.name}" /> <move file="${distrib.macosx.x86_64}/${distrib.product.name}.app" tofile="${distrib.macosx.x86_64}/${distrib.product.name}/${distrib.bin.name}.app" /> <move file="${distrib.macosx.x86_64}/doc" tofile="${distrib.macosx.x86_64}/${distrib.product.name}/doc" /> </target> </configuration> </execution> </executions> </plugin> </plugins> </build> </profile>
|
Attachment:
smime.p7s
Description: S/MIME cryptographic signature