Maven Java 1.6 Skeleton

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

    <build>
        <plugins>
            <!--
               Compiler Einstellungen: source und target Version auf Java 1.6 setzen
           -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

GWT Maven Plugin

Das GWT Maven Plugin ermöglicht es ein GWT Projekt auf verschiedenen Entwicklungsplattformen zu kompilieren bzw. zu testen. Dabei kümmert sich das Plugin um den Download der richtigen GWT Version für die aktuelle Plattform ( Windows, Mac, Linux ).

Zum aktivieren des Plugins muss man die pom.xml des aktuellen Projekts wie folgt anpassen.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <!--  
        Profile für die verschiedenen GWT Platformen: Linux, Mac, Windows
    -->
    <profiles>
        <profile>
            <id>gwt-dev-windows</id>
            <properties>
                <platform>windows</platform>
            </properties>
            <activation>
                <activeByDefault>true</activeByDefault>
                <os>
                    <family>windows</family>
                </os>
            </activation>
        </profile>
        <profile>
            <id>gwt-dev-mac</id>
            <properties>
                <platform>mac</platform>
            </properties>
            <activation>
                <activeByDefault>false</activeByDefault>
                <os>
                    <family>mac</family>
                </os>
            </activation>
        </profile>
        <profile>
            <id>gwt-dev-linux</id>
            <properties>
                <platform>linux</platform>
            </properties>
            <activation>
                <activeByDefault>false</activeByDefault>
                <os>
                    <name>linux</name>
                </os>
            </activation>
        </profile>
    </profiles>

    <!-- GWT Maven Plugin konfigurieren -->
    <pluginRepositories>
        <pluginRepository>
            <id>gwt-maven</id>
            <url>http://gwt-maven.googlecode.com/svn/trunk/mavenrepo</url>
        </pluginRepository>
    </pluginRepositories>
    <repositories>
        <repository>
            <id>gwt-maven</id>
            <url>http://gwt-maven.googlecode.com/svn/trunk/mavenrepo/</url>
        </repository>
    </repositories>

    <!--
        GWT Version des aktuellen Projekts festlegen
    -->
    <properties>
        <gwtVersion>1.5.3</gwtVersion>
    </properties>

    <build>
        <plugins>

            <!--
                Compiler Einstellungen: source und target Version auf Java 1.5 setzen
            -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.5</source>
                    <target>1.5</target>
                </configuration>
            </plugin>

            <!--
                Einstellungen für GWT Maven Plugin: host page festlegen, GWTCompiler optionen
            -->
            <plugin>
                <groupId>com.totsp.gwt</groupId>
                <artifactId>maven-googlewebtoolkit2-plugin</artifactId>
                <version>2.0-beta26</version>
                <configuration>
                    <compileTargets>
                                                <!-- Dieser Wert muss angepasst werden -->
                        <value>com.example.sample.Application</value>
                    </compileTargets>
                                        <!-- Dieser Wert muss angepasst werden -->   
                                        <runTarget>com.example.sample.Application/Application.html</runTarget>
                    <logLevel>INFO</logLevel>
                    <style>DETAILED</style>
                    <noServer>false</noServer>
                    <extraJvmArgs>-Xmx512m</extraJvmArgs>
                    <gwtVersion>${gwtVersion}</gwtVersion>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <!-- <goal>mergewebxml</goal> -->
                            <!--<goal>i18n</goal>-->
                            <goal>compile</goal>
                            <!-- <goal>test</goal>-->
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>unpack</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>com.google.gwt</groupId>
                                    <artifactId>gwt-dev</artifactId>
                                    <version>${gwtVersion}</version>
                                    <classifier>${platform}-libs</classifier>
                                    <type>zip</type>
                                    <overWrite>false</overWrite>
                                    <outputDirectory>${settings.localRepository}/com/google/gwt/gwt-dev/${gwtVersion}</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <!--  GWT deps (from central repo) -->
        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-servlet</artifactId>
            <version>${gwtVersion}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-user</artifactId>
            <version>${gwtVersion}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-dev</artifactId>
            <version>${gwtVersion}</version>
            <classifier>${platform}-libs</classifier>
            <type>zip</type>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-dev</artifactId>
            <version>${gwtVersion}</version>
            <classifier>${platform}</classifier>
            <scope>provided</scope>
        </dependency>
    </dependencies>
</project>