GWT maven project compiles and run from maven but don't compile and run in eclipse

500 Views Asked by At

I have multi module maven project, that is build with gwt as a main web framework. Here is github repo.

Everythink works as it should as I supose. I haven't got anything wrong.

Unfortunatelly the problems occur when I try to import this project into eclipse (as maven project). I can not compile this project (using RMB on project in Package Explorer -> Google -> GWT Compile).

I am getting an error:

Loading inherited module 'src.main.resources.pl.derp.parent'
   Loading inherited module 'pl.derp.shared'
      [ERROR] Unable to find 'pl/derp/shared.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?

When I tried to RMB on Project name in Package Explorer -> Run -> Run as Web application (GWT Super Dev Mode) I've got:

Working directory does not exist: /home/danielo/eclipseGwt/gwt_2.7.0_maven_eclipse/web/src/main/webapp

I've added modules to build path.

I've followed this instruction

I think, that I've done everything to make it work, but still can make it work.

I think the problem is in packages name, and the way they are treated by maven and eclipse. They are treated in diferent ways.

Maven easily find every class (f.e.: package pl.derp.web;) needed and compile. The eclipse is trying to find them by f.e.: src.main.java.pl.derp.web but can't found it.

Really I don't know how to resolve this issue? I am not sure witch package name patter is better (src.main.java.pl.derp.server or pl.derp.server)- for me the shorter is better.

To run this project in maven (it is well described here):

  • mvn clean install
  • mvn tomcat7:run-war-only

and in second shell:

  • mvn gwt:run -pl web

And in Eclipse I think I am running built in Jetty server

Please give me some help.

1

There are 1 best solutions below

1
On BEST ANSWER

You apparently have a single Eclipse project, with server, shared, and web declared as source directories. When using M2Eclipse, you should have 3 projects, each with their src/{main,test}/{java,resources} declared as source directories. At a minimum, without M2Eclipse, the source directories must be the src/{main,test}/{java,resources}, whether you have 1 or 3 projects.

This is why Eclipse looks for src.main.java.pl.derp.server instead of pl.derp.server, and why GWT fails too (classpath is similarly wrong).