Sunday, April 23, 2017

Re: GWT/Maven development cycle takes much too long



On Sunday, April 23, 2017 at 2:17:04 AM UTC+2, Magnus wrote:
Hello Jens,

I'm beginning to realize that removing scope=provided isn't a solution to the eclipse problem.
Sorry that this took so long...

However, then let's come back to the eclipse error again:

org.apache.maven.plugin.MojoExecutionException: Failed to copy file for artifact [msm.lib.acs:msm-lib-acs:jar:1.0-SNAPSHOT:compile]
...
Caused by: java.io.FileNotFoundException: /home/wagner/dvl/prj/msm/msm-lib-acs/target/classes (Is a directory)
 

I see two approaches then:

  • solve the eclipse error without removing scope=provided
    Does anyone have an idea what may be causing the eclipse error? What file is not found? What is the process behind this file access? Can you solve it by placing a dummy file somewhere?

Again: Eclipse tries (for some unknown reason) to package your webapp, so it needs to copy the library into the WEB-INF/lib. But because you have Eclipse resolve dependencies from the workspace, it will resolve to the lib's target/classes (because it won't package the lib –don't ask me why, M2Eclipse decision, Maven's weird/broken lifecycles–), and thus copying fails because the maven-war-plugin expects a JAR file and not a directory.
The root problem is that Eclipse wants to package the webapp.
As said several times already, you can workaround this by disabling "resolve dependencies from the workspace", but then you have to "mvn install" the library, and it severely hurts the developer experience (the original subject of this thread).
You may also want to use a more recent maven-war-plugin version, just in case…
The solution though is to go ask Eclipse/M2Eclipse experts why the hell Eclipse wants to package your webapp. And to do that, you need to make the smallest possible project that reproduces the problem.
  • using another maven plugin
    As some of you may have noticed in another thread, I was evaluating both, Mojo's and Thomas' eclipse plugin. Then, I saw that I can live with the pom.xml created by webAppCreator, without really caring about which plugin is used then.
    But I thought it was the "GWT way to go", since the pom was created by webAppCreator, which is shipped with the GWT SDK.

    However, in this thread, Thomas said that the Mojo-Haus plugin doesn't work in reactor builds. But I was unsure what I am actually using. When looking into my pom.xml I see a plugin with groupId = net.ltgt.gwt.maven. This seems to refer to Thomas' plugin. But in contrast, the error message refers to "MojoExecutionException". Sorry, but I still cannot follow this. Which plugin am I using? And if it's the "wrong" one, how can I switch in my existing pom.xml?
Again, "mojo" is a Maven term; the MojoExecutionException comes from Maven. This is different from MojoHaus, which just happens to (unfortunately and confusingly) reuse the term.
Note: the fact you have an error about the MojoHaus plugin when running "gwt:devmode" in the root project is because you don't explicitly use the net.ltgt.gwt.maven plugin in this project, and Maven defaults to trying out plugins from org.codehaus.mojo.
 
There seem to exist people without those problems. I simply want to do it the same way.

Last I tried (a while ago), things worked OK in Eclipse: it didn't try to package the webapp so it wasn't causing this error in the maven-war-plugin.
Again: the problem is the Eclipse wants to package your webapp; you need to figure out why and how to turn it off. And I believe this has nothing to do with the fact that you use GWT in your project (except possibly that it'll enable some behaviors in Eclipse; isolating the smallest possible project that triggers the error would determine whether this is the case).
It could be due to some Eclipse plugin you have installed, possibly even the GWT Eclipse Plugin, or to some configuration in your Eclipse install that differs from the default one.

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