score:42
EDIT: I've updated my answer with additional steps provided by the OP. Credits to the OP for the details.
I just broke my Eclipse setup trying to install the latest version of the Google Plugin for Eclipse (for GWT 2.0) so I can't confirm everything but, let's assume the following prerequisites are fulfilled:
- Eclipse 3.5
- Google Plugin for Eclipse (installed from http://dl.google.com/eclipse/plugin/3.5, see instructions)
- m2eclipse Plugin for Eclipse (installed from http://m2eclipse.sonatype.org/update)
Did you try to:
Create a new project from Eclipse (New > Other... then select Maven Project and choose the gwt-maven-plugin archetype).
Edit the generated
pom.xml
, update thegwt.version
property to2.0.0
(which has been released in the central repo),add the Codehaus Snapshot repositoryand set thegwt-maven-plugin
version to1.2-SNAPSHOT
(the version 1.2 isn't released in central, this should happen soon)1.2
(which has been released in central too).Add a
<runTarget>
to the gwt-maven-plugin configuration as documented in Using the Google Eclipse Plugin.Configure the maven-war-plugin as documented in the page mentioned in the previous step.
Manually enable GWT on the project from project preference by setting the Use Google Web Toolkit checkboxThis step is unnecessary since you'll be building/running with a Maven run configuration, not the GWT Plugin for Eclipse.
This is how my pom.xml
actually looks like:
<?xml version="1.0" encoding="UTF-8"?>
<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">
<!--
GWT-Maven archetype generated POM
-->
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany.demo</groupId>
<artifactId>my-gwtapp</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>gwt-maven-archetype-project</name>
<properties>
<!-- convenience to define GWT version in one place -->
<gwt.version>2.0.0</gwt.version>
<!-- tell the compiler we can use 1.5 -->
<maven.compiler.source>1.5</maven.compiler.source>
<maven.compiler.target>1.5</maven.compiler.target>
</properties>
<dependencies>
<!-- GWT dependencies (from central repo) -->
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwt.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
<scope>provided</scope>
</dependency>
<!-- test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.4</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<outputDirectory>war/WEB-INF/classes</outputDirectory>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>generateAsync</goal>
<goal>test</goal>
</goals>
</execution>
</executions>
<configuration>
<runTarget>com.mycompany.demo.gwt.Application/Application.html</runTarget>
</configuration>
</plugin>
<!--
If you want to use the target/web.xml file mergewebxml produces,
tell the war plugin to use it.
Also, exclude what you want from the final artifact here.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webXml>target/web.xml</webXml>
<warSourceExcludes>.gwt-tmp/**</warSourceExcludes>
</configuration>
</plugin>
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<warSourceDirectory>war</warSourceDirectory>
<webXml>src/main/webapp/WEB-INF/web.xml</webXml>
</configuration>
</plugin>
</plugins>
</build>
</project>
Run the gwt:eclipse
goal (using m2eclipse Maven2 > build...) to setup your environment and create the launch configuration for your GWT modules.
Run gwt:compile gwt:run
to compile and run a GWT module in the GWT Hosted mode.
score:0
very useful thread
@Pascal: thank you (I donot have enough reputations to comment on others posts; so here I am posting on what is working for me).
I needed 2.5.1 GWT (not 2.6, the latest) working with maven and eclipse (because sencha GXT is not supported for 2.6 yet). Tried following without luck
1)tried few archetypes with in eclipse to generate the project
2)modify pom file (based on above discussion) to change versions to 2.5.1
Following worked for me http://mojo.codehaus.org/gwt-maven-plugin/user-guide/archetype.html
mvn archetype:generate -DarchetypeGroupId=org.codehaus.mojo -DarchetypeArtifactId=gwt-maven-plugin -DarchetypeVersion=2.5.1
mvn gwt:eclipse
mvn gwt:run
score:1
Just in case. If you use Google GIN in your project you should add compile goal before gwt:compile. So the whole sequence would be:
compile gwt:compile gwt:run
You can read explanation here: http://code.google.com/p/google-gin/wiki/GinTutorial#Compilation
score:1
An annoying problem with GWT and m2eclipse:
GWT Development Mode requires all JARs to be placed in WEB-INF/lib. It's especially painful when programmers use m2eclipse, which provides its own Eclipse classpath container.
http://code.google.com/p/google-web-toolkit/issues/detail?id=5693
good news, the workaround is working for me
score:3
You can run the following command to generate a Maven GWT project:
webAppCreator -maven -noant -out
For more information:
Source: stackoverflow.com
Related Query
- Maven GWT 2.0 and Eclipse
- GWT Maven and Eclipse
- GAE and GWT - Using Maven instead of Google plugin for Eclipse
- Best practice to develop GWT (GXT) applications with Maven (3) and Eclipse
- gwt with maven and bootstrap eclipse starter project
- GWT maven project compiles and run from maven but don't compile and run in eclipse
- What causes imported Maven project in Eclipse to use Java 1.5 instead of Java 1.6 by default and how can I ensure it doesn't?
- M2E and having maven generated source folders as eclipse source folders
- How to build and run Maven projects after importing into Eclipse IDE
- Java Dynamic Web project with Maven and Eclipse
- Eclipse issue with Maven build and JDK when generating Qclasses in Querydsl
- Maven Profiles and Tomcat in Eclipse
- Eclipse error setting up Maven project for class exercise: Check $M2_HOME environment variable and mvn script match
- Create complete EAR Project with Maven and Eclipse Helios
- Where does Maven store the source and javadocs when downloaded via the Eclipse plugin
- Difference between Eclipse Build Project and Maven Compile command
- Is it currently possible to build Eclipse Plugins by Maven AND have nice IDE Integration?
- Missing tools-1.6.jar with Eclipse and Maven
- Import Maven Project to Eclipse and Fix the errors
- JAVA_HOME on OSX with Eclipse and Maven
- How to download sources and javadoc artifacts with Maven Eclipse plugin from other repository?
- Classpath trouble using JUnit with both Eclipse and Maven
- Eclipse WTP, maven and m2eclipse - not copying provided jars
- GWT Maven Eclipse Plugin - Compilation Fails Due to Duplicate Class
- Eclipse Maven Build and Test with One Button
- Maven and Eclipse : loading default properties in maven library project and use it in runnable Jar
- Maven and GWT (and Eclipse) - Does it really work?
- difference between building project using maven and eclipse export as Jar
- Setup a GWT Project correctly with SVN and Eclipse
- Problem with Eclipse and a Maven multi-module project
More Query from same tag
- Java EE perspective in Eclipse version 2.1.1
- Issue with program for renaming files
- IntelliJ Idea Community Edition - Quick Documentation Lookup
- Refreshing the Problems View in Eclipse
- R.java keeps references to non existing resource id's
- Eclipse behavior on Linux when shared by multiple users
- Input text in edittext reverts back to preset text inside expandable listview
- Nexus 5 USB driver
- Can Anyone tell me why the following error occurs - wrong orientation
- How can I refresh a ListView in a Fragment from the main Activity?
- make: *** [.o] Error 1
- org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'http://www.mulesoft.org/schema/mule/amqp/3.1/mule-amqp.xsd'
- GWT compilation failed
- How do you isolate a single project in Eclipse?
- Android “Unfortunately, <app> has stopped.”
- Can I sign an Android app using Apache Cordova (local build)
- How do Eclipse plugins work?
- I created clocks and I want to make the background transparent
- How do I make a constructor that assigns multiple parameters?
- how to print full page Jtable
- Eclipse static import content assist doesn't work
- Java Objects and Classes - something wrong with my code?
- Eclipse like annotations bar for VStudio C++
- New project using Spring MVC 5 in eclipse, but I am having error 404
- Eclipse loads separate activities instead of application
- Jenkins issue with maven install
- Cannot start JBoss from Eclipse
- Tomcat: depending the url, the css and javascript are run. why?
- Error when using sendKeys() with Selenium WebDriver Java.lang.CharSequence cannot be resolved
- Unable to change the package name in eclipse