With Dependencies to GWT-Custom Classes
How to use this template:
com.yourproject
and internal classes com.yourproject.internal
in your source folder.com.yourproject.internal
) using the template specified below.Example GWT-Integration module set up
mvn eclipse:clean clean package eclipse:eclipse -Declipse.pde -Declipse.useProjectReferences=false install
Features of this template:
Constraints of this template:
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- Template: https://sites.google.com/site/eclipsemaven/gwt-integration -->
<project>
<groupId>[XXX]</groupId>
<artifactId>[XXX]</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<gwtVersion>2.2.0</gwtVersion>
<module.draftCompile>true</module.draftCompile>
<module.importedPackages>
*
</module.importedPackages>
<module.exportedPackages>![XXX].internal*,[XXX]*
</module.exportedPackages>
<module.serviceDefinitions>
</module.serviceDefinitions>
</properties>
<!-- Dependent Modules -->
<dependencies>
<!-- add your project dependencies, they should be defined as projects in the eclipse workspace -->
<!-- for depedencies to GWT classes -->
<dependency>
<groupId>de.mxro.thrd.gwtuser</groupId>
<artifactId>thrdGWTUser</artifactId>
<version>[0.0.2,)</version>
<scope>provided</scope>
</dependency>
<!-- only for gwt maven plugin!!! -->
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<version>${gwtVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<!-- XXXXXXXXXXXXXX Maven declarations XXXXXXXXXXXXXXXXXX -->
<modelVersion>4.0.0</modelVersion>
<name>${project.artifactId}</name>
<packaging>bundle</packaging>
<build>
<outputDirectory>src/main/webapp/WEB-INF/classes</outputDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<!-- FOR BUNDLE MANAGEMENT -->
<!-- The Maven bundle plugin generates Meta-data required for OSGi -->
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<version>2.2.0</version>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Version>${project.version}</Bundle-Version>
<Import-Package>${module.importedPackages}</Import-Package>
<Export-Package>${module.exportedPackages}</Export-Package>
<Service-Component>${module.serviceDefinitions}
</Service-Component>
<Bundle-RequiredExecutionEnvironment>JavaSE-1.6
</Bundle-RequiredExecutionEnvironment>
</instructions>
</configuration>
</plugin>
<!-- XXXXXXXXXXXXXXXXXXXXXXXXXXXXX -->
<!-- For GWT -->
<!-- XXXXXXXXXXXXXXXXXXXXXXXXXXXXX -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.2.0</version>
<configuration>
<!-- <runTarget>Browser.html</runTarget>
-->
<draftCompile>${module.draftCompile}</draftCompile>
<logLevel>INFO</logLevel>
<!-- -->
<validateOnly>true</validateOnly>
<gwtVersion>${gwtVersion}</gwtVersion>
<!-- <modules> <module>nx.ui.gwttree.NxUiGwtTree</module> </modules> -->
<hostedWebapp>${basedir}/src/main/webapp</hostedWebapp>
<webappDirectory>${basedir}/src/main/webapp</webappDirectory>
<htmlunit>IE7</htmlunit> <!-- or IE6 or FF3, ... -->
<mode>htmlunit</mode>
<!-- <browser>C:\Program Files\Internet Explorer\ieexplore.exe</browser> -->
</configuration>
<executions>
<execution>
<id>gwtcompile</id>
<phase>prepare-package</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<!-- GWT tests are triggered in phase [integration-test] -->
<execution>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- FOR MAVEN ECLIPSE PLUGIN -->
<!-- Dependency Plugin used to copy the dependency JARs into the root
project folder. There the Maven eclipse plugin will add them to the classpath
of PDE projects. -->
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>process-sources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${basedir}</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
<!-- Cleanup necessary because of PDE tweaks, clear the project directory -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.3</version>
<configuration>
<filesets>
<fileset>
<directory>${basedir}</directory>
<includes>
<include>*.jar</include>
</includes>
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
</configuration>
</plugin>
<!-- Keep the MANIFEST.MF used by eclipse in sync with the MANIFEST.MF
created by the maven bundle plugin -->
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<delete file="${basedir}/META-INF/MANIFEST.MF" />
<copy file="src/main/webapp/WEB-INF/classes/META-INF/MANIFEST.MF"
tofile="${basedir}/META-INF/MANIFEST.MF" />
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<!-- RESOURCES -->
<resources>
<!-- Required to be valid GWT Library (requires *.java files in jar) -->
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.java</include>
<include>**/*.gwt.xml</include>
</includes>
</resource>
<!-- This entry makes sure that resources, which lie in the same package
as Java classes, are copied into the target. Often external libraries require
resources, which are loaded using Class.getResource or Class.getResourceAsStream
and which are in a subpackage of the class. For instance, the NetBeans template
for the Swing Application Framework does so. -->
<resource>
<filtering>false</filtering>
<directory>src/main/java</directory>
<includes>
<include>**</include>
</includes>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
<!-- This entry makes sure component definitions for OSGi declarative
services are copied into the destination -->
<resource>
<targetPath>OSGI-INF</targetPath>
<filtering>false</filtering>
<directory>OSGI-INF</directory>
<includes>
<include>**</include>
</includes>
</resource>
<!-- I really do not know why know a manual entry for src/main/resources
is necessary? It should be included following the Maven convention. -->
<resource>
<filtering>false</filtering>
<directory>src/main/resources</directory>
<includes>
<include>**</include>
</includes>
</resource>
</resources>
</build>
</project>
DummyEntryPoint.java
public class DummyEntryPoint {
public void onModuleLoad() {
}
}
[YourModuleName].gwt.xml
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='[XXX eg mymodulename]'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />
<!-- Other module inherits -->
<!-- <inherits name='com.yourproject.DependentModule'></inherits> -->
<!-- Specify the app entry point class. -->
<entry-point class='[XXX].internal.DummyEntryPoint' />
<!-- Specify the paths for translatable code -->
<source path='' />
</module>