Friday, April 21, 2017

Re: GWT/Maven development cycle takes much too long



On Friday, April 21, 2017 at 5:58:58 PM UTC+2, Magnus wrote:
Hi Thomas,

I already have started to play with a reactor. Below is my top-level pom.xml. But where to go from here?
What are the mvn commands to build everything on the top-level? If "mvn install" isn't needed anymore, how does the app project see the library?

Because msm-apl-mcs has a dependency on msm-lib-acs, Maven will always build the latter before the former (when executed on the whole reactor).
If the "package" phase is part of the build (e.g. you execute "mvn package" or "mvn verify" for example), then the JAR for msm-lib-acs will be "attached" to the project and will be used by "msm-apl-mcs". Otherwise (e.g. you use "mvn test" or "mvn gwt:devmode"), "msm-lib-acs" will have no known attached artifact, so "msm-apl-mcs" will have to use something else (this is why I recommend never using phases before "package" when invoking Maven in reactors; the "gwt:devmode" goal has special handling for reactor builds, contrary to the "gwt:run" from the MojoHaus' plugin); and if msm-lib-acs has packaging 'jar' and the dependency is on the jar type with no classifier, then it'll be its target/classes folder, and otherwise it'll be nothing (IIRC).

So, "mvn package" should Just Work™ (package the lib, then package the app using the lib's jar).
"mvn gwt:devmode" and "mvn gwt:codeserver" should work without too much configuration (configure warDir/launcherDir, possibly projects/modules)
 
This is also the point with the development cycle: When debugging, eclipse doesn't "see" the changed library source code, because it fetches the library source code from the jar file in its own target folder.

Actually the one from your local repository (~/.m2/repository/), not directly the one from the target/ folder.
 
And this jar file is updated only by "mvn install" at the app project. Wouldn't it be better for developing if the original library code was used instead? Could it be that this is the core of the problem?

Yes, it is.
And the problem is that Eclipse errors when importing your app project when using the default configuration for resolving dependencies from the workspace; which is why you turned that setting off.
If you figure out how to get this working, then it should (hopefully work) the same with or without a reactor.
But with a reactor at least you can have things working with "mvn gwt:devmode" and/or "mvn gwt:codeserver" (and your developers could then possibly switch to other IDEs if you allow them to: NetBeans, IntelliJ IDEA, or even VSCode)
Tweaking the classpath for the DevMode launcher in Eclipse to include the lib's project and source folders could also be a temporary workaround while you figure things out on the Eclipse project import front.

--
You received this message because you are subscribed to the Google Groups "GWT Users" 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 https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment