|
|
|
|
|
|
|
Re: how do I bundle a jre with an RCP appl on Mac OSX [message #1699825 is a reply to message #1636512] |
Fri, 26 June 2015 17:48   |
Eclipse User |
|
|
|
I have done this within our product and have it working. It's tricky because if you're using Maven to build, OS X's JRE symlink's libjvm.dylib - which Java's unzip invariably screws up.
I was only able to get this to work by using Tycho, as the app export within the PDE is just plain broken (and seemingly unmaintained). This bug has been there for quite some time - I don't have any faith in it ever getting fixed, regardless of whatever bugzilla says.
If you're building RCP apps for distribution - you should probably consider using Tycho anyways; admittedly there's a lot of BS that comes with it, but it's the only seemingly straightforward way to build and package an RCP app in a headless manner for continuous integration. Buckminster is supposedly also a solution - but it has less information and support than Tycho - so YMMV.
Anyways back to your problem. Using Tycho with some custom maven magic, I was able to solve this. Essentially I downloaded the JRE from Oracle, and uploaded to our Artifactory so I could reference it using maven coordinates. I unpack that tar.gz package into the OS X distribution directory and place the package under the <your app name>.app/jre. Because of the symlink munging - you have to go and fix that, so remove the existing zero byte libjvm.dylib and relink it using ant exec. Now that you have a good JVM, you need to modify the config.ini to use the right JRE. Unfortunately you can only build this on OS X or Linux - Windows is SOL unless you can find a way to use Cygwin or equivalent. Since I'm doing this outside of Tycho's archiving phase (and theres not apparently way to slip my changes in between), I have to recreate the OS X archive.
Hopefully this helps you solve your problem... I beat my head against the wall trying to fix this for several weeks trying to find a working solution as the error reporting is completely incorrect.
Anyways, good luck!
<profiles>
<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.bin.name}.app"/>
<move file="${distrib.macosx.x86_64}/jre${distrib.jre.version}.jre" tofile="${distrib.macosx.x86_64}/${distrib.bin.name}.app/jre"/>
<symlink action="delete" link="${distrib.macosx.x86_64}/${distrib.bin.name}.app/jre/Contents/MacOS/libjli.dylib" />
<symlink link="${distrib.macosx.x86_64}/${distrib.bin.name}.app/jre/Contents/MacOS/libjli.dylib"
resource="../Home/lib/jli/libjli.dylib" overwrite="true"/>
<concat destfile="${distrib.macosx.x86_64}/${distrib.bin.name}.app/Contents/MacOS/${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.bin.name}.app/Contents/MacOS/${distrib.bin.name}.ini"/>
</concat>
<move file="${distrib.macosx.x86_64}/${distrib.bin.name}.app/Contents/MacOS/${distrib.bin.name}.ini"
tofile="${distrib.macosx.x86_64}/${distrib.bin.name}.app/Contents/MacOS/${distrib.bin.name}_bak.ini" />
<move file="${distrib.macosx.x86_64}/${distrib.bin.name}.app/Contents/MacOS/${distrib.bin.name}_temp.ini"
tofile="${distrib.macosx.x86_64}/${distrib.bin.name}.app/Contents/MacOS/${distrib.bin.name}.ini" />
</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}" />
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.3.1</version>
<executions>
<execution>
<id>manual-archive-mac</id>
<phase>pre-integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>zip</executable>
<workingDirectory>${distrib.macosx.x86_64}/..</workingDirectory>
<arguments>
<argument>-r</argument>
<argument>-q</argument>
<argument>-dd</argument>
<argument>--symlinks</argument>
<argument>${archive.macosx.x86_64}</argument>
<argument>${distrib.root}</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.24614 seconds