view content/Maven/cross-jdk-project-files-continued.md @ 112:cf31bf5fce72 default tip

Author of the blog post as mail header for efficient spam filtering
author Dirk Olmes <dirk.olmes@codedo.de>
date Tue, 06 Sep 2022 07:04:11 +0200
parents 1d9382b0329b
children
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

    :::shell
    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:

    :::shell
    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>