Thursday, November 20, 2014

Re: GWT compile fails with default Maven directory structure

Sounds like a bug or misconfiguration of the GPE. Is the project a "Maven project" in Eclipse? There might be some hard-coded paths in the GPE (because of limitations of Eclipse) that are only triggered in one or the other "mode" (Maven vs. "simple" Eclipse project). E.g. "/test" being excluded from the GWT Compiler and DevMode classpath in "simple" projects, and the test sources (defaulting to "src/test/java" and "src/test/resources"), as declared in your Maven POM, in Maven projects.
Also, this being a GPE issue, you might have better luck in the dedicated Google Group <https://groups.google.com/d/forum/google-plugin-eclipse> or on StackOverflow.

On Thursday, November 20, 2014 6:05:27 PM UTC+1, Phineas Gage wrote:
I'm in the process of Maven-izing my GWT 2.6.1 project (an intermediate step to start using GWT 2.7.0), and as a first step want to switch to maven style directory structure (as suggested by the Maven GWT Plugin documentation), so I make two simple moves:

[project]/src => [project]/src/main/java

[project]/test => [project]/src/test/java

But what happens when I do this is that the regular "GWT Compile" from the Google Plugin for Eclipse fails with the -strict option, because it tries to compile my test classes as GWT source code, and of course can't find the classes they reference, for example (source files names obfuscated with extra ...'s):

      [ERROR] Errors in 'file:/.../src/test/java/.../...Test.java'
         [ERROR] Line 20: No source code is available for type org.junit.Assert; did you forget to inherit a required module?
      (... repeated with many other files)

I'm confused because this doesn't happen with my old directory structure, and I don't know why the GWT compiler would go back up into my test directory to compile classes there. Strangely, it also doesn't happen with this structure, which I accidentally moved to once:

[project]/src => [project]/src/java/main

[project]/test => [project]/src/java/test

It almost seems like the GWT compiler is doing something special with the default Maven directory structure. And any of the solutions I can think of are not very clean:

- Not use the Google Plugin for Eclipse, but only use the Maven GWT Plugin, but then I lose some features from the Google Plugin for Eclipse that I want
- Not compile with -strict, but then I don't catch other warnings as easily
- Use an exclude in my *.gwt.xml source paths to exclude **/*Test.java, but then I might still catch some unintended utility classes in my test package
- Not use a parallel package structure for my tests, but then it's not possible to test package protected classes and methods
- Not make [project]/src/test/java a source directory in Eclipse, but I don't know what the side effects of that are

How are people handling this, or am I missing something?

--
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