GWT: Custom war location for debug configuration

I'm trying to debug a GWT 2.3 front-end that talks to an existing REST-based back end.  What I'd like to do is allow the back-end to serve the GWT files out directly using the GWT noserver flag, as that mimics the production configuration and eliminates cross-domain concerns.  The existing code makes meaninful use of methods besides just GET, so cross-domain solutions would be more invasive to the back end.

Currently, I have created a run configuration with both "-noserver" and "-war /x/y/z/myLocation" parameters.  The GWT plugin is already passing in its own -war parameter, but this 2nd one seems to override; it must be an absolute path, as it appears that the working directory is the parent directory of the default war location.

For the most part, this works, as changes are picked up immediately and logging is properly sent to the GWT debug panel.  But, breakpoints are not honored, presumably because the GWT plugin doesn't know anything about my 2nd WAR location.

Is there a better way to accomplish this?  I've also tried playing with symbolic links to the default GWT war location, as well as trying to include that path in my existing application.  But, none of those work well.  I'm about to break down and use Apache's mod_proxy to split the traffic out to my existing server and the standard GWT Jetty instance, but that seems like an overly complicated solution.

If there is no better way to accomplish this, any chance that we could get a war location option for GWT configurations?  Ideally, it would be possible to specify this relative to the module or project roots, making it much easier to share run configurations.  This would make it much easier to use the noserver GWT option the way it was designed.

Thanks,
Mike

4 comments
Comment actions Permalink

Why do you need to set custom war location? What problems do you have with default value of '-war' parameter provided by IDEA?

--
Nikolay Chashnikov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

0
Comment actions Permalink

The IDEA-chosen war location is inside the caches directory in a directory named with some sort of hash (or random number).

The noserver option for GWT starts the GWT code server, but not the web server.  Files that should be served from the web server must be served from a separate web server.  In order to do that, I need to tell our web server from where these files should be served; additionally, the GWT documentation tells us to run an ant build with the target directory set to the same war directory (step #4 here).  Hence, the IDEA-chosen directory is inconvenient, at best, as both the web server and build.xml script must be modified to point to the IDEA chosen war dir.

The noserver option is designed for serving GWT generated artifacts from an external webserver like this.  The two most often reasons that this is required are EJB applications (because Jetty lacks EJB) and to avoid cross-domain issues when using GWT with an existing back end (our case).

I am an experienced IDEA user, but this is the first time I've used GWT; if there is a better way to use the noserver option in IDEA, please do let me know.

Thanks,
Mike

0
Comment actions Permalink

As far as I understand '-war' parameter in step #4 refers to GWT compiler options not GWT Dev Mode options so you don't need to change '-war'
parameter in GWT Run Configuration in IDEA.

You can use the IDEA features (artifacts) to call GWT compiler and produce the exploded war directory instead of using build.xml files. To work with
GWT 'noserver' mode you need to create two artifacts ('Project Structure' | 'Artifacts' item). The first artifact is used to produce the exploded war
directory, it can be created using '+' -> 'Web Application: exploded' -> 'From modules' action. The second artifact is used to call the GWT compiler
once as described in step #4 in GWT docs. To create it press '+' button, select 'Other' type, drag 'GWT Compiler output' item from the 'Available
elements' tree to the 'Output Layout' tree and then change 'Output directory' for the second artifact to point to the same directory as 'output
directory' for the first artifact.

When artifacts are configured you need to build the second artifact once using Build | 'Build Artifact' action. After that you can start your back-end
server from IDEA using corresponding run configuration and start GWT run configuration in 'noserver' mode without overriding '-war' parameter.

--
Nikolay Chashnikov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

0
Comment actions Permalink

Thanks -- this solution does seem to work.

Though for no reason I can understand, it doesn't seem to update web resources on frame deactivation.  It does update GWT files just fine.  But, I have to manually rebuild the web artifact.

I managed to solve this by eliminating the web artifact and simply pointing the output of the "Other" artifact at the war directory created by the existing build script.  Everything works perfectly this way.

Granted, using artifacts is very much the normal way to do things using IDEA, but it seems a bit unnecessary in this case.  A custom war location would eliminate the need for the artifact entirely.  Granted, this might be somewhat of an edgecase, but the noserver option is built specifically to handle odd deployment configurations, and I'd be surprised if even IDEA's flexible artifact configuration can match every one of them.

Thanks again for the help; the revised configuration is much better.

--Mike

0

Please sign in to leave a comment.