Wednesday, February 4, 2015

Re: Eclipse Luna SR1 w/ GPE 3.8.0 -- Compilation error on GWT 2.7 project, builds fine w/ Maven 3



On Tuesday, February 3, 2015 at 7:53:11 PM UTC+1, Laurent D wrote:

Hello there,


I decided to give GWT 2.7 a quick test using Thomas Broyer's "Multi project setup" sample included as part of its gwt-maven-plugin source:

(doc: http://mojo.codehaus.org/gwt-maven-plugin/user-guide/multiproject.html)

(source: https://github.com/gwt-maven-plugin/gwt-maven-plugin/tree/master/src/it/reactor)


Note: this is not "my" plugin, I'm just pushing updates and releases from time to time. "My" plugin is https://github.com/tbroyer/gwt-maven-plugin, and "my" multi-module setup can be found at https://github.com/tbroyer/gwt-maven-archetypes
The "setup" you're linking to is an integration test, not a sample (as warned in the documentation)

 

While building this project with Maven 3.0.5 only required minor tweaking of the reactor project's pom (basically replacing  '@pom.version@' and '@gwt.version@' placeholders with hard-coded values), I was unable to get it to compile with GPE under Eclipse, using the 'Google > GWT Compile' option. The error I first got (which did not make much sense IMHO...) was:

Compiling module org.codehaus.mojo.gwt.test.Hello
   Looking for precompiled archives.  To disable, use -Dgwt.usearchives=false
   Loading archived module: jar:file:/C:/Local/maven2/repository/com/google/gwt/gwt-user/2.7.0/gwt-user-2.7.0.jar!/com/google/gwt/core/Core.gwtar
[ERROR] Unexpected internal compiler error
java.lang.NoClassDefFoundError: org/objectweb/asm/MethodVisitor
 at java.lang.ClassLoader.defineClass1(Native Method)
 at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
 at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)

 .../...
 
 Caused by: java.lang.ClassNotFoundException: org.objectweb.asm.MethodVisitor
 at java.net.URLClassLoader$1.run(URLClassLoader.java:366)

 .../...


I then tried to edit the POM and use "2.5.1" as GWT version and had the compiler complain about not being able to find the 'HelloAsyncService' class...
I checked and it was actually in the 'target/generated-sources/gwt' of the 'war' project, and this source directory was not on the Java Build Path in Eclipse (I guess  the POM is missing a 'maven-build-helper-plugin' exection for adding this directory as source directory in Eclipse...)

Eclipse is supposed to auto-detect that folder as a source folder (I never tried it though, I don't use gwt:generateAsync, heck I don't even use RPC); try updating the project (from memory: right-click → Maven → update project from POM).
 
 
Anyway, just manually adding 'target/generated-sources/gwt' as a source folder to the Java Build Path and retrying 'Google > GWT Compilation', this time the project compiled fine with GPE in Eclipse.
 
Feeling relieved and confident I had finally nailed it, I then changed back the GWT version to 2.7.1 in the 'reactor' project POM to have another try, but this time I got this error in Eclipse:
 

Loading inherited module 'org.codehaus.mojo.gwt.test.Hello'
   Loading inherited module 'com.google.gwt.user.User'
      Loading inherited module 'com.google.gwt.core.Core'
         Loading inherited module 'com.google.gwt.core.CompilerParameters'
            [ERROR] Element 'module' beginning on line 17 contains unexpected attribute 'type'
            [ERROR] Failure while parsing XML
com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
 at com.google.gwt.dev.util.xml.DefaultSchema.onUnexpectedAttribute(DefaultSchema.java:72)
 at com.google.gwt.dev.util.xml.Schema.onUnexpectedAttribute(Schema.java:80)

 
Again, this does not seem to make much sense as an 'mvn clean package' on the 'reactor' project works fine on the command line with Maven 3.0.5, as does an 'mvn gwt:compile' on the child 'war' project...

 

For the record, I'm using 32-bit Eclipse 4.4.1 on Windows 7, with GPE v3.8.0.v201410302155-rel-r44


Any ideas as to the likely cause for this error and how it can be remedied please?


As it's an Eclipse-specific failure, I'd ask on the GPE forum (which actually asks you to ask on StackOverflow): https://groups.google.com/d/forum/google-plugin-eclipse
 


I am getting more and more fed up with the Eclipse WTP, M2E and GPE deadly combination.... No offense meant, but this shaky tooling really ruins the GWT coding experience... I spend all day tweaking things in Eclipse so that I can make my GWT projects compile, and then I have to battle again to have them run in Dev Mode or Super Dev Mode as the case may be... It really is a gigantic pain, we lose whole days trying to just setup a project correctly so that it will compile and run...


The start of a solution is to always first understand what you want to do, then have your tools do it.
I don't quite understand why you'd want to compile from within Eclipse, and IIRC that's not really configuration.
DevMode and SuperDevMode are almost-regular launchers so you can easily tweak them to add/remove arguments, or folders to/from the classpath. And if that doesn't work the way you like, then just create regular launchers.
 

Can we expect a new version of GPE anytime soon? Also, it would greatly help if you could update the GPE documentation that is rather thin, especially as far as the GWT side of things is concerned...


This is something you should ask to the GPE guys.
 

I am aware that people working on these various tools do their best and I do not mean to be disrespectful, but the situation has really been giving very bad press to GWT for years, and it does not seem to improve much... Setting up and developing a GWT project is already error-prone and complicated enough, we really need some more robust tooling and documentation / checklists to support development...


Sorry for such a long rant, and hoping you can provide some guidance on this,


HTH 

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment