hosted mode web.xml merge location seems off

67 views
Skip to first unread message

Jason

unread,
Jun 9, 2009, 6:16:29 PM6/9/09
to Codehaus Mojo gwt-maven-plugin Users
Hi All,
I'd like to suggest a change to MergeWebXmlMojo.java in this plugin to
clarify documentation.

On line 50 of r9947, this:
/**
* Location on filesystem where project should be built.
*
* @parameter expression="${project.build.directory}"
*/
private File buildDir;

could be changed to:
/**
* Location on filesystem where the web.xml will be merged.
*
* @parameter expression="${project.build.directory}"
*/
private File buildDir;

I figured out how to get my GWT RPC services to run using the plugin
with minimal configuration compared to other folks [1] [2] [3] after
reading the source code of the plugin because of this line. The
underlying issue is that the web.xml file is merged in place by the
MergeWebXmlMojo; the source and target directory and filename are the
same when the GWT RPC services are added to the file.

To make it one step clearer for users, it'd be great to rename
"buildDir" to "webXmlMergeDir", in the MergeWebXmlMojo.java file.

Once I figured this out, the GWT RPC services "just work" with a
plugin config similar below, and -without- configuring the maven-war-
plugin or jetty plugin as others have done (again [1], [2], [3]).

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>1.1-SNAPSHOT</version>
<configuration>
<runTarget>org.myapp.Application/Application.html</runTarget>
<hostedWebapp>${project.build.directory}/hostedWebapp</
hostedWebapp>
<!-- SEE HERE, buildDir MUST BE WITHIN THE hostedWebapp -->
<buildDir>${project.build.directory}/hostedWebapp/WEB-INF</
buildDir>
</configuration>
<executions>
<execution>
<id>full</id>
<goals>
<goal>mergewebxml</goal>
<goal>compile</goal>
<goal>run</goal>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>

Hope it helps someone else. If leadership desires, I can submit a
patch for this, just let me know.

cheers,
Jason


[1]
http://groups.google.com/group/codehaus-mojo-gwt-maven-plugin-users/browse_thread/thread/86cec82399b3fcc8/b904c391b99bc647?hl=en&lnk=gst&q=pom#b904c391b99bc647

[2]
http://groups.google.com/group/codehaus-mojo-gwt-maven-plugin-users/browse_thread/thread/a65d06c3309d5f9b/f252fc86c8f3cb33?lnk=gst&q=web.xml#f252fc86c8f3cb33

[3] http://milen.commsen.com/2009/04/run-gwt-application-in-hosted-mode-from-maven.html

nicolas de loof

unread,
Jun 10, 2009, 3:05:00 AM6/10/09
to codehaus-mojo-gwt-...@googlegroups.com
Not sure what was the intention in this Mojo (I don't use it myself) but it seems it exepected the war plugin to be configured to use the generated web.xml to package the webapp.

What about changing the parameter to point to the merged file instead of containing folder :

/**
    * Location on filesystem for the merged web.xml. maven-war-plugin must be configured to
    * use this one for packaging the webapp.
    *
    * @parameter expression="${project.build.directory}/web.xml"
    */
   private File mergedWebXml;

the buildDir would then be deprecated.

Nicolas

2009/6/10 Jason <JasonT...@gmail.com>

nicolas de loof

unread,
Jun 10, 2009, 3:07:17 AM6/10/09
to codehaus-mojo-gwt-...@googlegroups.com
Also, as you seem to use the mergeWebXml goal, could you please check my patch at http://jira.codehaus.org/browse/MGWT-58 and tell me if the mergewebxml goal still works fine with those changes ?

2009/6/10 nicolas de loof <nicolas...@gmail.com>

Jason

unread,
Jun 16, 2009, 2:43:59 PM6/16/09
to Codehaus Mojo gwt-maven-plugin Users
Hi Nicolas,

I've tested your patch, using SVN r9991. It works partially, however
because of the buildDir's
@parameter expression="${project.build.directory}"
it is never null, therefore the deprecated buildDir will always
override the value of the new mergedWebXml, even if it is explicitly
set. Also, the log.warn statement will always fire because it's never
null.

Since buildDir is deprecated, and the mergedWebXml is set to:
@parameter expression="${project.build.directory}/web.xml"
the buildDir expression can be eliminated, and it will then default to
null.

I've submitted a patch to fix this here:
http://jira.codehaus.org/browse/MGWT-88

cheers,
Jason
Reply all
Reply to author
Forward
0 new messages