gwt-maven-plugin 2.5.0 ; goal gwt:run-codeserver; Invokes lifecycle phase process-classes; Expected invocation of generate-sources;

1,082 views
Skip to first unread message

Oliver Krylow

unread,
Nov 9, 2012, 1:52:23 PM11/9/12
to codehaus-mojo-gwt-...@googlegroups.com
Hi!

This is not a big issue and the workaround is easy. 

Just invoke 
mvn generate-sources gwt.run-codeserver

instead of 
mvn gwt:run-codeserver

The reason I noticed this is because we like to structure our GWT Projects so that all *.gwt.xml-files live in src/main/gwt and we like to copy over the src/main/webapp folder to the target folder and generate the WAR there, instead of the weird convention of generating it directly in src/main/webapp .

That means we add the sources src/main/webapp and src/main/gwt during the generate-sources phase ,thus the GWT-compiler fails to find the *.gwt.xml-modules if we use mvn gwt:run-codeserver only.

The reason why the goal invokes process-classes is probably as an optimization to not invoke the phase compile unnecessarily, but if I may, I would like to propose the change that it invokes generate-sources instead.

Typically the goal is only invoked once daily ;), so I would not mind the performance overhead.

Best regards,

Oliver


Thomas Broyer

unread,
Nov 9, 2012, 4:51:04 PM11/9/12
to codehaus-mojo-gwt-...@googlegroups.com


On Friday, November 9, 2012 7:52:23 PM UTC+1, Oliver Krylow wrote:
Hi!

This is not a big issue and the workaround is easy. 

Just invoke 
mvn generate-sources gwt.run-codeserver

instead of 
mvn gwt:run-codeserver

The reason I noticed this is because we like to structure our GWT Projects so that all *.gwt.xml-files live in src/main/gwt and we like to copy over the src/main/webapp folder to the target folder and generate the WAR there, instead of the weird convention of generating it directly in src/main/webapp .

Generating anything inside src/ is not a convention, it's an anti-pattern (I don't even understand why the maven-war-plugin has an in-place mojo, which the gwt-maven-plugin copied).
No, clearly, the convention is to generate and run the webapp from target/, the equivalent of war:exploded

That means we add the sources src/main/webapp and src/main/gwt during the generate-sources phase ,thus the GWT-compiler fails to find the *.gwt.xml-modules if we use mvn gwt:run-codeserver only.

The reason why the goal invokes process-classes is probably as an optimization to not invoke the phase compile unnecessarily, but if I may, I would like to propose the change that it invokes generate-sources instead.

process-classes happens *after* classes (otherwise, there would be no classes to process, only sources)

I honestly don't understand why that doesn't work with "mvn gwt:run-codeserver" and works with "mvn generate-sources gwt:run-codeserver".
Which Maven version are you using?

Thomas Broyer

unread,
Nov 9, 2012, 4:51:36 PM11/9/12
to codehaus-mojo-gwt-...@googlegroups.com


On Friday, November 9, 2012 10:51:04 PM UTC+1, Thomas Broyer wrote:


On Friday, November 9, 2012 7:52:23 PM UTC+1, Oliver Krylow wrote:
Hi!

This is not a big issue and the workaround is easy. 

Just invoke 
mvn generate-sources gwt.run-codeserver

instead of 
mvn gwt:run-codeserver

The reason I noticed this is because we like to structure our GWT Projects so that all *.gwt.xml-files live in src/main/gwt and we like to copy over the src/main/webapp folder to the target folder and generate the WAR there, instead of the weird convention of generating it directly in src/main/webapp .

Generating anything inside src/ is not a convention, it's an anti-pattern (I don't even understand why the maven-war-plugin has an in-place mojo, which the gwt-maven-plugin copied).
No, clearly, the convention is to generate and run the webapp from target/, the equivalent of war:exploded

That means we add the sources src/main/webapp and src/main/gwt during the generate-sources phase ,thus the GWT-compiler fails to find the *.gwt.xml-modules if we use mvn gwt:run-codeserver only.

The reason why the goal invokes process-classes is probably as an optimization to not invoke the phase compile unnecessarily, but if I may, I would like to propose the change that it invokes generate-sources instead.

process-classes happens *after* classes (otherwise, there would be no classes to process, only sources)

Sorry, I meant after compile.

Oliver Krylow

unread,
Nov 9, 2012, 6:25:27 PM11/9/12
to codehaus-mojo-gwt-...@googlegroups.com
Oh wait, now that I am sane again, I realize that I totally mixed up the meaning of "invoking a lifecycle phase" for a second. 
Don't ask me why ,but I thought invoking "process-classes" meant: "process-classes" -> "generate-test-sources" -> "process-test-sources" -> etc.. My apologies :)

Nevertheless, the issue persists and now that I am home, I boiled it down to an example project showcasing it.


I would be happy if you could unzip the project and run "mvn gwt:run-codeserver" and "mvn generate-sources gwt:run-codeserver" in succesion. 
I would be even more happy if you could tell me what I am doing wrong :)

This was tested on a Windows 7 64bit machine with maven 3.0.4 embedded in m2e and on a custom gentoo 64bit box with maven 3.0.3 .

Steps to reproduce:
  1. unzip example.zip
  2. cd example
  3. mvn gwt:run-codeserver
Expected output:
...
[INFO] Next, visit: http://localhost:9876/


Actual output:
...
[INFO] --- gwt-maven-plugin:2.5.0:run-codeserver (default-cli) @ example ---
[WARNING] GWT plugin is configured to detect modules, but none were found.
[ERROR] java.lang.IllegalArgumentException: Usage: at least one module must be supplied
[ERROR] at com.google.gwt.dev.codeserver.CodeServer.start(CodeServer.java:73)
[ERROR] at com.google.gwt.dev.codeserver.CodeServer.main(CodeServer.java:51)
...


Should you be interested, here is the complete maven dump.

Thank you for your time :)

Oliver

Thomas Broyer

unread,
Nov 9, 2012, 10:54:52 PM11/9/12
to codehaus-mojo-gwt-...@googlegroups.com
I'd have called for a Maven bug (because build-helper-maven-plugin:add-source is correctly invoked in "mvn gwt:run-codeserver") if it weren't working for gwt:run. Really strange; I must be missing something, but I can't find what

Oliver Krylow

unread,
Nov 10, 2012, 12:33:02 PM11/10/12
to codehaus-mojo-gwt-...@googlegroups.com
Okay, here is the next strange thing :)  

Invoking 

mvn process-classes gwt:run-codeserver

yields the expected results. 

The only notacible difference for my untrained eyes is, that the RunMojo.java has 

@execute phase=process-classes goal:war:exploded

while SuperDevModeMojo.java has only

@execute phase=process-classes .

But I do not know enough about Mojo dev to know if that is the cause.


Reply all
Reply to author
Forward
0 new messages