gwtproject / gwt

GWT Open Source Project
http://www.gwtproject.org
1.52k stars 374 forks source link

GWT 2.1 compiled with gwt-maven-plugin gives "GWT module 'stockwatcher' may need to be (re)compiled" #5510

Closed dankurka closed 9 years ago

dankurka commented 9 years ago

Originally reported on Google Code with ID 5511

Found in GWT Release (e.g. 1.5.3, 1.6 RC):
GWT 2.1.0 + gwt-maven-plugin 1.3.2.google (from http://google-web-toolkit.googlecode.com/svn/2.1.0/gwt/maven/org/codehaus/mojo/gwt-maven-plugin/1.3.2.google/)

Encountered on OS / Browser (e.g. WinXP, IE6-7, FF3):
Windows / Chrome & Firefox

Detailed description (please be as specific as possible):
I've played around a bit with GWT 2.1 RC1 and now with the released 2.1 version. So
far I've been working only with the eclipse plugins. Since my project is becoming more
complex I want to use maven to manage the build and dependencies.

I found that the gwt-maven-plugin (google version) has also been released for 2.1:
http://google-web-toolkit.googlecode.com/svn/2.1.0/gwt/maven/org/codehaus/mojo/gwt-maven-plugin/1.3.2.google/

To start very simple I downloaded the StockWatcher sample project from http://google-web-toolkit.googlecode.com/files/Tutorial-GettingStarted-2.1.zip
I've remove the GreetingService related classes to make sure that the project does
not require any server related components. I first compiled the project with the eclipse
plugin and using the (manually configured) 2.1 SDK from http://google-web-toolkit.googlecode.com/files/gwt-2.1.0.zip.
Then I run the StockWatcher.html in my browser and it works as expected (though not
in Chrome for some odd reason). Note that I'm running without a web server and in production
mode (i.e. without the "?gwt.codesvr=127.0.0.1:9997" at the end).

Next I want to build exactly the same but using the gwt-maven-plugin. I created the
pom.xml and moved all java files and resources to the appropriate places (i.e. src/main/java
etc).
I got everything to a stage that mvn package works and the project seems to compile
fine. However, when I run the StockWatcher.html, I get an alert with the message "GWT
module 'stockwatcher' may need to be (re)compiled". I did some analysis of the differences
between the eclipse compiled project and the maven compiled project and found differences
in 3 files.

The first two files seem unrelated to the problem (though I don't know why the difference
is there):
standard_rtl.css
standard.css

The ones from eclipse contains an extra style definition in both files:
.gwt-MenuBar .gwt-MenuItem-disabled {
  color: #c0c0c0;
}

The next difference is in the stockwatcher.nocache.js.
Along with other small differences it literally contains Ob="GWT module 'stockwatcher'
may need to be (re)compiled"

Note that all other compiled javascipt is exactly the same, even the file names.

Also when I copy the stockwatcher.nocache.js from the eclipse compiled project to the
maven compiled project it does work.

I have attached both projects (including output) in the attached zip file.

Reported by westerhoff on 2010-10-30 08:27:19


dankurka commented 9 years ago
I have encountered the exact same problem! Have you found a solution for it?

Reported by thobias.karlsson on 2010-11-21 20:37:27

dankurka commented 9 years ago
Same issue here... got the message "GWT module 'stockwatcher' may need to be (re)compiled"...
ideas?

Reported by thiefofwisdom on 2011-01-18 18:44:20

dankurka commented 9 years ago
Same error with eclipse Galileo and GWT plugin 3.5. A lot of time and this problem has
not been corrected

Reported by oscarcascantefonseca on 2011-03-11 16:26:08

dankurka commented 9 years ago
Hi guys. I had the same problem. This solved the problem for me:

http://googlewebtoolkit.blogspot.com/2010/08/how-to-use-google-plugin-for-eclipse.html

=> So in order to make the production WAR file you need to make:
mvn clean gwt:compile package

Reported by HenkHb1 on 2011-04-15 13:11:19

dankurka commented 9 years ago
Could it be because gwt-maven-plugin tries to not recompile the app if it thinks it
doesn't need too? It does so probably by comparing the *.nocache.js timestamp with
the timestamps of source files, so if you cleaned then ran your app in devmode (which
generated a minimal *.nocache.js) and then compile without changing your code, the
plugin probably thinks it doesn't need to compile the app.
If my analysis is correct, you can do an "mvn -Dgwt.compiler.force=true gwt:compile
package" to force the GWT compilation, without the other steps –such as Java compilation–
that a "mvn clean" would have implied.

Reported by t.broyer on 2011-04-15 21:44:18

dankurka commented 9 years ago
It's not an issue with GWT proper, as the GWT compiler always overwrites the *.nocache.js
file. It might be an issue with the gwt-maven-plugin, though I'd rather say the problem
is about how it's being used: see http://stackoverflow.com/a/5745870/116472 for instance,
and comment #5 above.

Reported by t.broyer on 2012-08-23 11:39:40