Configure GWT deployment context within Eclipse IDE

Do you know this problem?
When starting a GWT application within the dev-mode it will be deployed in the root context. But when building the project and deploying it, e.g., usually some context other than root will be used (on Tomcat for instance, the name of the war file will be used by default).

Solution
To configure the deployment context in the IDE, place a “jetty-web.xml” in your application’s WEB-INF folder containing the following code:

<?xml version="1.0" encoding="UTF-8"?>
<!DOC TYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<configure>
    <set name="contextPath">/myAppContext</set>
</configure>

The package structure is also shown by the following screenshot:

To be able to open the application via double-click in the Eclipse “Development Mode” view, you need to adjust the launch configuration. To do so, navigate to the confiration’s “Arguments” tab and adjust the -startupUrl value in the “Program arguments” section.

Short URL for this post: http://blog.oio.de/BG0s9
This entry was posted in Eclipse Universe, Java Web Frameworks and tagged , , , , . Bookmark the permalink.

Leave a Reply