Posts Tagged ‘GWT’

HOWTO: Remove GWT package from url when using gwt-maven

Friday, March 13th, 2009

Seriously, who wants a url like /my.long.package.name.Application/Application.html

To remedy this use the following steps:

  1. 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>
    ...
  2. 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>
    ...
  3. 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">
  4. Your done.

Additional resources:
http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/f8b06676098b8cc6

http://groups.google.com/group/gwt-maven/browse_thread/thread/a46f540ca823e3d3/7d5febf0776958db?lnk=gst&q=rename#7d5febf0776958db