Thursday, April 20, 2017

Re: GWT/Maven development cycle takes much too long



On Tuesday, April 18, 2017 at 6:03:29 PM UTC+2, Magnus wrote:
Hello,

after moving my projects to Maven, I am at a point where everything works again, with the help of the people in this group.
However, when concentrating on the actual work again, I notice that the development cycle I have started with takes too long, so that I cannot be productive in any way.
I am sure that it can be improved somehow, but how?

Here is the simplified scenario:

There are two Maven projects:
  • my-lib:
    a code library for any code (server-side and GWT-aware) that may be used by more than one application
  • my-app:
    an actual GWT application that uses the library
The library project is built with the install goal (mvn install), so its jar file is stored in the local repository. This jar file in the repository is gripped by the application project, which has a corresponding dependency in its pom.xml file.
Both projects are imported into eclipse.

When everything is up-to-date, I can select "Debug as GWT Development Mode with Jetty", run and debug the application without any problems.
So far so good. Now it comes:

Sometimes I see a problem in the library code while debugging. Then, I want to stop debugging and edit the code. But then, the code is not editable, because eclipse is showing the source code included in the library jar file, not the original code from the library's Maven project. You can see that eclipse shows the source code labeled with a *.class file instead of a *.java file:


So, I cannot edit the code immediately. I have to open the original file and edit the code there.
But what after having done this?

The application project cannot "see" the changed code, because it only sees the jar file with the unchanged code in the local repository.
It also doesn't seem that eclipse realizes this and does all the necessary steps automatically: When I start a new debugging session after having changed the code, I see the old code in the class file, as described above.

So the only thing I can do right now is go to the command line an do this:
  • update the library and update the local repository:
    mvn package install
  • update the application, so that it fetches the new library jar file from the repository into its WEB-INF/lib directory
    mvn package
Especially the second step takes very long, since it will compile the permutations.

Passing property gwt.compiler.skip=true will skip GWT compilation.
 
After that I have to do a "Refresh" inside eclipse for both projects.
Then, finally, I can start a new debugging session again.

But wait: What is it that I wanted to do when coming back here? #-)
The cycle described above takes about 20 minutes.

What am I doing wrong?

As I already said several times, I strongly suggest you use a reactor (multi-module build) so that you don't need to "mvn install" the library before you can use it; at least when using "mvn gwt:devmode" and/or "mvn gwt:codeserver". (to answer your questions from another thread, use whatever you want as groupId/artifactId/version for the root/reactor module, it really doesn't matter if you're only using it for development; it only matters if you "mvn install" and/or "mvn deploy" it)
I have no idea why Eclipse has errors when importing/updating the "app" project, and I hope you'll eventually find out and find a fix/workaround, but I would personally focus on getting things working outside the IDE (with Maven only), and then only getting them working with/in the IDE. Then you can possibly use the GWT Eclipse Plugin to run your app instead of Maven.

That being said, you can have things working right now, by (manually) tweaking the classpath for the dev mode, to include the "lib" project *and* source folders.

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