Cross JDK project files with Maven (continued)

21.03.2008 by Dirk Olmes

In my last blog entry 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

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

Comments

There are no comments yet.

Leave a comment
Your name:
Comment: