HOWTO: Remove GWT package from url when using gwt-maven
Friday, March 13th, 2009Seriously, who wants a url like /my.long.package.name.Application/Application.html
To remedy this use the following steps:
- Make the webapp directory the same as the output for your gwt code.
... <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <configuration> <webappDirectory>${project.build.directory}/${project.build.finalName}/my.long.package.name.Application </webappDirectory> </configuration> </plugin> ...
- Ensure that your rpc servlets don’t have the package as a prefix.
... <plugin> <groupId>com.totsp.gwt</groupId> <artifactId>maven-googlewebtoolkit2-plugin</artifactId> ... <configuration> ... <webXmlServletPathAsIs>true</webXmlServletPathAsIs> </configuration> ... </plugin> ...
- Change your index.html file to point to your app.
From:<meta http-equiv="REFRESH" content="0;url=my.long.package.name.Application/Application.html">To:
<meta http-equiv="REFRESH" content="0;url=Application.html"> - Your done.
Additional resources:
http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/f8b06676098b8cc6