Creating a new Maven + GWTproject
This section outlines what is needed to create a new Java project that is configured correctly for both Maven and GWT. To setup a project correctly, we will be depending on the gwt-maven-plugin: http://mojo.codehaus.org/gwt-maven-plugin/.
From command line run the following command, and fill in all of the variables:
mvn archetype:generate \ -DarchetypeRepository=repo1.maven.org -DarchetypeGroupId=org.codehaus.mojo \ -DarchetypeArtifactId=gwt-maven-plugin \ -DarchetypeVersion=2.1.0-1
- By default this seems to assume you want to use java 1.5, so we need to change the following files to use 1.6:
- ./settings/org.eclipse.jdt.core.prefs
- ./settings/org.eclipse.wst.common.component
- ./settings/org.eclipse.wst.common.project.facet.core.xml
- pom.xml
- Once you have everything set you are ready to import the new project into eclipse.
- Now set the correct library path in eclipse by doing the following:
- Right-click the project root in the package explorer and select properties.
- Under the Java Build Path tab, select Libraries.
- Remove the 1.5 JRE library.
- Select Add Library...
- Select JRE System Library then Next, and choose a 1.6 library.
- Right-click the project root in the package explorer and select properties.
- Open the pom.xml in an editor and make the following changes:
In the gwt-maven-plugin, comment-out the generateAsync goal as it conflicts with the GWT eclipse plugin:
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>gwt-maven-plugin</artifactId> <version>2.1.0-1</version> <executions> <execution> <goals> <goal>compile</goal> <goal>test</goal> <goal>i18n</goal> <\!-\- <goal>generateAsync</goal>--> </goals>