Review
In the previous section, we have studied how to generate a simple GWT application using the GWT Maven plugin. We've also learned how integrate Spring and GWT using the GWTHandler library. In this section, we will build and run the application using Maven, and show how to import the project in Eclipse (if you've decided in Part 2 to use command-line based development).Table of Contents
Part 1: Introduction and Functional SpecsPart 2: Generating the GWT project
Part 3: Integrating Spring and GWTHandler
Part 4: Running the Application
Running the Application
Access the source code
To download the source code, please visit the project's Github repository (click here)Building with Maven
- Ensure Maven is installed
- Open a command window (Windows) or a terminal (Linux/Mac)
- Run the following command:
mvn gwt:run
- You should see the following output:
[INFO] Scanning for projects... [INFO] ------------------------------------------ [INFO] Building GWT Maven Archetype [INFO] task-segment: [gwt:run] [INFO] ------------------------------------------ [INFO] Preparing gwt:run [INFO] [gwt:i18n {execution: default}] [INFO] [gwt:generateAsync {execution: default}] [INFO] [gwt:run {execution: default-cli}] [ERROR] INFO: Mapped URL path [/greet] onto handler of type [class org.gwtwidgets.server.spring.GWTRPCServiceExporter] [ERROR] Feb 5, 2012 2:49:45 PM org.springframework.web.servlet.FrameworkServlet initServlet
Note: If the project will not build due to missing repositories, please enable the repositories section in the pom.xml!
Access the Entry page
- Follow the steps with Building with Maven
- Open a browser
- Enter the following URL (8080 is the default port for Tomcat):
Or better yet, on the GWT Development Mode window, click on the Launch Default Browser button.http://127.0.0.1:8888/gwtmodule.html?gwt.codesvr=127.0.0.1:9997
Import the project in Eclipse
- Ensure Maven is installed
- Open a command window (Windows) or a terminal (Linux/Mac)
- Run the following command:
mvn eclipse:eclipse -Dwtpversion=2.0
- You should see the following output:
[INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'eclipse'. [INFO] org.apache.maven.plugins: checking for updates from central [INFO] org.apache.maven.plugins: checking for updates from snapshots [INFO] org.codehaus.mojo: checking for updates from central [INFO] org.codehaus.mojo: checking for updates from snapshots [INFO] artifact org.apache.maven.plugins:maven-eclipse-plugin: checking for updates from central [INFO] artifact org.apache.maven.plugins:maven-eclipse-plugin: checking for updates from snapshots [INFO] ----------------------------------------- [INFO] Building GWT Maven Archetype [INFO] task-segment: [eclipse:eclipse] [INFO] ----------------------------------------- [INFO] Preparing eclipse:eclipse [INFO] [gwt:i18n {execution: default}] [INFO] [gwt:generateAsync {execution: default}] [INFO] [eclipse:eclipse {execution: default-cli} [INFO] Adding support for WTP version 2.0. [INFO] ----------------------------------------- [INFO] BUILD SUCCESSFUL [INFO] -----------------------------------------
This command will add the following files to your project:
.classpath .project .settings target
You may have to enable "show hidden files" in your file explorer to view them
- Open Eclipse and import the project
Maven Issues
If in case you have Maven repository issues, you can always download the depedencies directly from Sonatype OSS for Google GWT.Conclusion
That's it! We've have successfully completed our GWT and Spring integration. We've learned how to generate a simple GWT project using the GWT Maven plugin, and integrate Spring using the GWTHandler library.I hope you've enjoyed this tutorial. Don't forget to check my other tutorials at the Tutorials section.
Revision History
Revision | Date | Description |
---|---|---|
1 | Feb 5 2012 | Uploaded tutorial and Github repository |
Share the joy:
|
Subscribe by reader Subscribe by email Share
Be aware I'm new to Spring and Maven, so there is no telling what I could have done wrong, but I'm sharing here in case anyone else might run across this:
ReplyDeleteFor some reason (could be the version of SpringSource Tool Suite, etc., I'm using) I had to add a few Maven dependencies (in the pom.xml) to get these final steps of Spring and GWT integration in this tutorial:
org.springframework
spring-context
3.1.1.RELEASE
org.springframework
spring-core
3.1.1.RELEASE
org.springframework
spring-web
3.1.1.RELEASE
org.springframework
spring-webmvc
3.1.1.RELEASE
net.sf.gwt-widget
gwt-sl
1.1
Should the tests work when a "mvn install" is performed ? Currently there is a test failure.
ReplyDeletehi, a very nice article.I followed the same steps i got remote procedure call as a failure..what might be the possible mistake i've done..
ReplyDeleteThanks
hai
ReplyDeletei am follwed same steps for integrating spring with gwt but getting failure meassage when we submit
Invalid gwtmodule/rpc/* in servlet mapping
ReplyDelete