view content/Maven/cross-jdk-project-files-continued.md @ 74:8de1cc117d89 pelican_comment_system

merge changes from default branch
author Dirk Olmes <dirk@xanthippe.ping.de>
date Sun, 03 Jan 2016 00:54:02 +0100
parents 4cd9b65e10e4
children 1d9382b0329b
line wrap: on
line source

Title: Cross JDK project files with Maven (continued)
Date: 2008-03-21
Lang: en

In [my last blog entry](|filename|./cross-jdk-project-files.md) I described the steps for cross-JDK Eclipse project files.

Unfortunately there's more Eclipse internals involved when dealing with cross platform issues. It turns out that the correct JRE_CONTAINER for Linux and Windows is

    org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk

but that doesn't work for Mac where it needs to be like this:

    org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/jdk

So for real cross platform project files you need to put the launcher type into a property and override that in a mac specific profile. The final pom will look similar to this

    :::xml
    <project ...>
        <properties>
            <vmtype>org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType</vmtype>
            <jdkName>jdk1.4</jdkName>
        </properties>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-eclipse-plugin</artifactId>
            <version>2.5</version>
            <configuration>
                <classpathContainers>
                    <classpathContainer>
                        org.eclipse.jdt.launching.JRE_CONTAINER/${vmtype}/${jdkName}
                    </classpathContainer>
                </classpathContainers>
            </configuration>
        </plugin>

        <profiles>
            <profile>
                <id>mac</id>
                <activation>
                    <os>
                        <family>mac</family>
                    </os>
                </activation>
                <properties>
                    <vmtype>org.eclipse.jdt.internal.launching.macosx.MacOSXType</vmtype>
                </properties>
            </profile>
        </profiles>
    </project>