The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

severian (5) [Avatar] Offline
#1
Charlie

You mention here: (http://groups.google.co.uk/group/gwt-maven/msg/bdd2eb3163a01d74?&hl=en&q=maven+junit+gwt) that you have a gwt junit test that runs via maven2. However, the specific part of GWTIP you mention (GWTIP/Ch10/GWTTestMe) is not (yet?) available in the source zip on the manning web-site. Is it possible to make the sample project available? Despite much effort, I cannot get gwt junit tests to run in maven2, and the above thread is the closest I can find on the web to a solution. Tantalisingly close, but not explicitly explained ... smilie

Thanks.
charlie.collins (125) [Avatar] Offline
#2
Re: GWT, Junit & Maven2
In that previous thread I was saying that I have a "build" for several projects that has *both* M1 and M2 pom files and so on. Both projects build and run all the gwt-maven plugin goals (run the GWTShell and GWTCompiler, mergewebxml, war, etc) but the M2 stuff still does not run tests. Sorry if my wording there implied otherwise.

Cooper is working on the M2 testing stuff right now. Basically there is a problem with M2 in the way it sets up dependencies and the classpath for testing (through the Maven plugin architecture) blows up. We know this is a big deal, and we consider it a priority (it will get fixed soon).

Throughout the book (and in real life smilie), I am still using Maven 1 for my GWT projects. I am having no problems with M1 (and in my experience that goes for a few other plugins as well, not just GWT). For each project in the book I am working on making sure both M1 and M2 poms and properties are supported, using the M2 structure, and launch shell/compile/build war work. For tests though I have to skip them on M2 (-Dmaven.test.skip=true) - for the time being. We (Cooper and I) hope to be able to go back and update the book to make M2 the primary tool for the examples, including testing, once we have the M2 GWT testing stuff ironed out. (The plan is of course that both M1 and M2 work, for each project, including testing and all other aspects - but we are not yet there with gwt-maven.)
severian (5) [Avatar] Offline
#3
Re: GWT, Junit & Maven2
Ahhhhh, sorry Charlie, thanks a million for clearing that up for me. I'll stop trying to get maven2 working with gwt tests in the meantime.

Keep up the good work with the book, I'm devouring the chapters & source with interest.
charlie.collins (125) [Avatar] Offline
#4
Re: GWT, Junit & Maven2
I think by adding the dev jar to the system profile classpath, Cooper may have solved the problem. Does not make for the prettiest of pom files, but he advises that it should work (I have not yet had a chance to go through it and try it).

http://groups.google.com/group/gwt-maven/browse_thread/thread/e52cc225f818ee4?hl=en
severian (5) [Avatar] Offline
#5
Re: GWT, Junit & Maven2
Charlie

Thanks again for the prompt help. Unfortunately, I'd already seen Cooper's post and still couldn't get it to work. Indeed, the 2nd post in that thread is from myself (posted round about the same time as I started this thread), showing the exception stack trace I received.

It seems that Cooper's idea gets the classpath set up correctly for the junit test runner, but the embedded tomcat instance cannot find gwt-dev-windows.jar to launch the GWTShellServlet entered in the generated web.xml. I've tried some further hacking by moving the jar into the embedded tomcat ROOT webapp, but run into further trouble due to duplicate inclusion of commons.logging etc (which is embedded in the dev jar).

Perhaps I'm missing something obvious? Does "mvn test" run the gwt junit tests in the "wrong" mode (e.g. web mode rather than hosted mode)?
charlie.collins (125) [Avatar] Offline
#6
Re: GWT, Junit & Maven2
Ah, sorry. I will make it a point to prioritize this tomorrow (Monday) and get with Cooper to figure out what's up.
charlie.collins (125) [Avatar] Offline
#7
Re: GWT, Junit & Maven2
There are some updates in the gwt-maven thread about this. Classloader issue with GWT, I think Cooper submitted a one line patch to the GWT team, and I believe locally things should work using that patch version (which he has also distributed, see the other thread) - on Windows and Linux (not on Mac).
severian (5) [Avatar] Offline
#8
Re: GWT, Junit & Maven2
Thanks Charlie. I've been keeping an eye on the other thread.
jgaupp (1) [Avatar] Offline
#9
Re: GWT, Junit & Maven2
Hy you two,

I'm currently trying to setup up a maven-based build support and ran into the same problems. I gave the above-mentioned thread a try, but to be honest: I couldn't make it work.

I was wondering whether one of you found a solution to this problem? More over when will Chapter5 be available (MEAP)? If this is anytime soon, maybe I could postpone my efforts concerning this.

Best regards smilie
severian (5) [Avatar] Offline
#10
Re: GWT, Junit & Maven2
My understanding is that it's not yet fixed. See http://groups.google.com/group/gwt-maven/browse_thread/thread/e52cc225f818ee4?hl=en. It'd obviously be nice if I was wrong tho...
charlie.collins (125) [Avatar] Offline
#11
Re: GWT, Junit & Maven2
The fix is not in GWT yet. The patch fixes things though. http://code.google.com/p/google-web-toolkit/issues/detail?id=1032

At JavaOne (actually at the offsite GWT hack during JavaOne) Cooper and I discussed this a bit with Bruce and Joel (and others on the GWT team). They are aware of the issue and though it will not be in 1.4 it will surely get some attention at some point. For now the solution is the GWT patch.

(And I am not sure exactly when MEAP will get updated - soon though. We have lots of new and updated book content, we will try to get it into MEAP as soon as possible.)
jaepo (2) [Avatar] Offline
#12
Re: GWT, Junit & Maven2
You can found an "easy to use Maven GWt Plugin" at http://gwtforge.com
kebernet (11) [Avatar] Offline
#13
Re: GWT, Junit & Maven2
Yeah. The GWTForge version won't run your GWTTestCases and has a lot fewer features. The GWT-Maven one does debugging, Shell execution and some other stuff.

I know the GWTForge guy was specifically worried about continuum, which honestly, we don't use. The GWT-Maven code will work with Hudson and Cruise that I know of.
kebernet (11) [Avatar] Offline
#14
Re: GWT, Junit & Maven2
Oops. I guess I should mention -- I just saw the age of this thread -- the Maven 2 GWT plugin will now run GWT Test cases as a separate goal. The next version of GWTiP that gets MEAPed and the final version will have full details on running it.
charlie.collins (125) [Avatar] Offline
#15
Re: GWT, Junit & Maven2
Yeah, gwtforge will specifically NOT help in any way with what this thread is talking about - and has far fewer features than GWT-Maven.

As Cooper noted, the GWT-Maven plugin, for M2, does now work with GWTTestCase based tests - and the text throughout the book has been updated (though it's not yet updated in MEAP, should be soon).
jaepo (2) [Avatar] Offline
#16
Re: GWT, Junit & Maven2
Well .

You're right when you said that the gwt forge maven plugin doesn't run the test .

But it was not the developpement goal .

The plugin is just here to demonstrate another way to compile gwt sources without complex configuration and without downloading the "18.6 M" of the gwt distribution

It 's just an easy way to compile your gwt sources .

Sorry for the thread ,we have never wanted to criticize gwt-maven , but we just want to help people to discover and use the best ajax framework of theses years .

Best regards .

http://gwtforge.com
charlie.collins (125) [Avatar] Offline
#17
Re: GWT, Junit & Maven2
I don't think anyone took this as criticism of GWT-Maven (clearly some of the stuff on the gwtforge web site, which is inaccurate and incorrect, seems aimed at GWT-Maven, but not this thread), but, the point, again, is that this thread was specifically about running the tests.

A plugin that only runs the GWTCompiler has no relevance in this thread - hence the comments.

Also, GWT-Maven does not require 18.6 M of dependencies and a complex configuration. The dependencies, number and size, are relative to what you want to do (and really, so is the configuration). Most people will want gwt-user and sometimes gwt-server, at a minimum. If you just want to run the compiler, you don't need many dependencies, or much configuration. GWT-Maven can do that, the minimum, too (it *can* do a lot more than that, but that is up to the user).