Tuesday, February 24, 2015

Re: GWT & Dagger 2

The project class paths that are included in GWT compile command are:

On Tuesday, February 24, 2015 at 1:29:17 PM UTC, Vasco Andrade Silva wrote:
Hi all,

I've been trying Dagger 2 with GWT and have been fighting to get things working. Could someone help?

My pom:



<extraJvmArgs>-Xmx2048M -XX:MaxPermSize=128M</extraJvmArgs>

My issues are:

#1 generated sources aren't available for gwt compilation

mvn compile

no errors are found in the compilation phase, dagger 2 generated sources land in target/generated-sources/annotations/

However running:

mvn compile gwt:compile

GWT compilation outputs the following error:

[ERROR] Errors in 'file:/path/to/project/src/main/java/path/to/project/client/ProjectEntryPoint.java'
[INFO] [ERROR] Line 79: No source code is available for type path.to.project.client.Dagger_ProjectComponent; did you forget to inherit a required module?
[INFO] [ERROR] Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly

the problem seems related with the fact that GWT compilation isn't including the generated sources, as target/generated-sources/annotations/ isn't included in the classpath of the GWT compiler. The project class paths that are included in GWT compile command are:

#2 Eclipse "doesn't follow" Dagger 2 generate sources (not related with GWT per-si)
I configured Eclipse (Luna edition) with m2e-apt plugin (http://marketplace.eclipse.org/content/m2e-apt). My project works as a maven project in Eclipse.

However when I change something in dagger (Component, Module, etc.) the generated sources aren't immediately generated, I need to do "Maven > Update Project".

#3 Eclipse imports errors on Dagger 2 generated files open (not related with GWT per-si)
When I open a file that was generated by dagger 2 (in target/generated/sources/annotations) eclipse doesn't know how to import other sources from target/generated/sources/annotations which lead to several compile time errors in those generated files. Additionally, from that point on Eclipse confuses himself and makes the project source files (in src/main/java) that are referring to generated dagger files (e.g. Dagger_ProjectComponent) to also be in error (eclipse doesn't know anymore to import those symbols).

To overcome this I have to do "Maven > Update Project". Note, however, that every time I open a dagger2 generated file, this happens again.

Has someone succeeded getting dagger 2 and GWT (and Eclipse) working together smoothly?

Also, any help to overcome the reported issues would be great (specially issue #1).

Thank you,

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