Then you can omit GWT compilation at all before you are going to start super-dev-mode because codeserver itself will also compile everything again.
And finally you can edit and instant rebuild in superdevmode (it takes few seconds).
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 libraryThe 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 packageEspecially the second step takes very long, since it will compile the permutations.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?Thanks
Magnus
--
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-tool...@googlegroups.com.
To post to this group, send email to google-we...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
You did not address the special problem with the two maven projects:
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?
pom.xml:<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"><modelVersion>4.0.0</modelVersion><groupId>msm</groupId><artifactId>msm</artifactId><version>1.0</version><packaging>pom</packaging><packaging>pom</packaging><modules><module>msm-lib-acs</module><module>msm-apl-mcs</module></modules></project>
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?
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.
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?
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)
Could not find goal 'devmode' in plugin org.codehaus.mojo:gwt-maven-plugin:2.8.0 among available goals...
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.
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?
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.
[INFO] Reactor Build Order:[INFO][INFO] msm-lib-acs[INFO] msm.app.bcs.Application[INFO] msm[INFO] ------------------------------------------------------------------------[INFO] Reactor Summary:[INFO][INFO] msm-lib-acs ....................................... SKIPPED[INFO] msm.app.bcs.Application ........................... SKIPPED[INFO] msm ............................................... SKIPPED[INFO] ------------------------------------------------------------------------[INFO] BUILD FAILURE[INFO] ------------------------------------------------------------------------[INFO] Total time: 2.603s[INFO] Finished at: Fri Apr 21 19:13:32 CEST 2017[INFO] Final Memory: 10M/241M[INFO] ------------------------------------------------------------------------[ERROR] Could not find goal 'devmode' in plugin org.codehaus.mojo:gwt-maven-plugin:2.8.0 among available goals clean, compile, compile-report, css, debug, eclipse, eclipseTest, generateAsync, help, i18n, mergewebxml, resources, run, run-codeserver, source-jar, test -> [Help 1][ERROR][ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.[ERROR] Re-run Maven using the -X switch to enable full debug logging.[ERROR][ERROR] For more information about the errors and possible solutions, please read the following articles:
Failed to copy file for artifact [msm.lib.acs:msm-lib-acs:jar:1.0-SNAPSHOT:compile] (org.apache.maven.plugins:maven-war-plugin:2.2:war:default-war:package)org.apache.maven.plugin.MojoExecutionException: Failed to copy file for artifact [msm.lib.acs:msm-lib-acs:jar:1.0-SNAPSHOT:compile]at org.apache.maven.plugin.war.packaging.ArtifactsPackagingTask.performPackaging(ArtifactsPackagingTask.java:131)at org.apache.maven.plugin.war.packaging.WarProjectPackagingTask.handleArtifacts(WarProjectPackagingTask.java:190)at org.apache.maven.plugin.war.packaging.WarProjectPackagingTask.performPackaging(WarProjectPackagingTask.java:109)at org.apache.maven.plugin.war.AbstractWarMojo.buildWebapp(AbstractWarMojo.java:472)at org.apache.maven.plugin.war.AbstractWarMojo.buildExplodedWebapp(AbstractWarMojo.java:404)at org.apache.maven.plugin.war.WarMojo.performPackaging(WarMojo.java:215)at org.apache.maven.plugin.war.WarMojo.execute(WarMojo.java:177)at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:331)at org.eclipse.m2e.core.internal.embedder.MavenImpl$11.call(MavenImpl.java:1362)at org.eclipse.m2e.core.internal.embedder.MavenImpl$11.call(MavenImpl.java:1)at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176)at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:112)at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:1360)at org.eclipse.m2e.core.project.configurator.MojoExecutionBuildParticipant.build(MojoExecutionBuildParticipant.java:52)at org.eclipse.m2e.core.internal.builder.MavenBuilderImpl.build(MavenBuilderImpl.java:137)at org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:172)at org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:1)at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod$1$1.call(MavenBuilder.java:115)at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176)at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:112)at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod$1.call(MavenBuilder.java:105)at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176)at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:151)at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:99)at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.execute(MavenBuilder.java:86)at org.eclipse.m2e.core.internal.builder.MavenBuilder.build(MavenBuilder.java:200)at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:735)at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:206)at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:246)at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:301)at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:304)at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:360)at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:383)at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:144)at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:235)at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)Caused by: java.io.FileNotFoundException: /home/wagner/dvl/prj/msm/msm-lib-acs/target/classes (Is a directory)at java.io.FileInputStream.open0(Native Method)at java.io.FileInputStream.open(FileInputStream.java:195)at java.io.FileInputStream.<init>(FileInputStream.java:138)at org.codehaus.plexus.util.io.FileInputStreamFacade.getInputStream(FileInputStreamFacade.java:36)at org.codehaus.plexus.util.FileUtils.copyStreamToFile(FileUtils.java:1141)at org.codehaus.plexus.util.FileUtils.copyFile(FileUtils.java:1048)at org.apache.maven.plugin.war.packaging.AbstractWarPackagingTask.copyFile(AbstractWarPackagingTask.java:293)at org.apache.maven.plugin.war.packaging.AbstractWarPackagingTask$1.registered(AbstractWarPackagingTask.java:150)at org.apache.maven.plugin.war.util.WebappStructure.registerFile(WebappStructure.java:211)at org.apache.maven.plugin.war.packaging.AbstractWarPackagingTask.copyFile(AbstractWarPackagingTask.java:145)at org.apache.maven.plugin.war.packaging.ArtifactsPackagingTask.performPackaging(ArtifactsPackagingTask.java:106)... 38 more
So, "mvn package" should Just Work™ (package the lib, then package the app using the lib's jar).Yes, works!"mvn gwt:devmode" and "mvn gwt:codeserver" should work without too much configuration (configure warDir/launcherDir, possibly projects/modules)Actually, it gives an error (see below):Could not find goal 'devmode' in plugin org.codehaus.mojo:gwt-maven-plugin:2.8.0 among available goals...I believe I have to extend the minimal top-level pom.xml, but how?And I'd like to leave the pom.xml in the sub folders as is, because they are working for their own... Is this possible?
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.This is an important point! If the app used the library jar from the repository and not from its own target directory, there would be no need to "mvn package" the app and this takes most of the time...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?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.I can enable it for the lib project without problems. But as soon as I enable it for the app project, the error reappears.It's hard to figure it out when even the experts in this group have no idea. But I see that this is an essential point, so I have documented the error as detailed as possible again (see below). I hope there will be a solution...
Maybe another scope is better?
The external libs (like postgresql-40.0.0.jar) must be copied into the WEB-INF/lib directory. When scope=provided, it isn't copied there. That was the problem in the other thread.How can I solve this?
The question scope=provided or not affects the dependency for my own library "my-lib" in the pom.xml of my application "my-app".
So by changing scope=provided I can only choose between problem 1 and problem 2.
There may be some misunderstandings:The question scope=provided or not affects the dependency for my own library "my-lib" in the pom.xml of my application "my-app".
- If I remove it, the "Failed to copy file for artifact" returns (= problem 1).
- If I keep it, the external libraries referenced by "my-lib" (like postgresql-40.0.0.jar) don't get copied into the WEB-INF/lib folder of "my-app" (problem 2).
So by changing scope=provided I can only choose between problem 1 and problem 2.
Now you said that problem 2 isn't a problem, because the external libraries are provided at runtime, e. g. by Tomcat.
The question scope=provided or not affects the dependency for my own library "my-lib" in the pom.xml of my application "my-app".
- If I remove it, the "Failed to copy file for artifact" returns (= problem 1).
- If I keep it, the external libraries referenced by "my-lib" (like postgresql-40.0.0.jar) don't get copied into the WEB-INF/lib folder of "my-app" (problem 2).
So by changing scope=provided I can only choose between problem 1 and problem 2.Yep, between one correct build that doesn't import in Eclipse (because of Eclipse), or an "incorrect" build (from your requirements).
Now you said that problem 2 isn't a problem, because the external libraries are provided at runtime, e. g. by Tomcat.No.I'm saying you should not use scope=provided if that's not what you want (and it's not what you want, so don't use it), and find a solution (or workaround at least) for the Eclipse issue,
Your requirements is to have the JARs into the WAR (just like most other people, so your requirements aren't wrong), so DO NOT use scope=provided.
Ok, but how can I have the JARs into the WAR then?If this is what most other people want, then there must be a solution...
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)
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?
- 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?
There seem to exist people without those problems. I simply want to do it the same way.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>${VERSION.GWT}</version>
<configuration>
<runTarget>MyPage.html</runTarget>
<module>com.mycompany.EntryPoint</module>
<sourceLevel>1.7</sourceLevel>
<port>8095</port>
<codeServerWorkDir>${project.build.directory}</codeServerWorkDir>
<logLevel>INFO</logLevel>
<extraJvmArgs>-Xmx1024M -Xms256M</extraJvmArgs>
<gwtSdkFirstInClasspath>true</gwtSdkFirstInClasspath>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<version>${VERSION.GWT}</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-codeserver</artifactId>
<version>${VERSION.GWT}</version>
</dependency>
</dependencies>
</plugin>
And because I use gwt 2.6 - gwt settings:
<add-linker name="xsiframe"/>
<set-configuration-property name="devModeRedirectEnabled" value="true"/>
<set-configuration-property name='xsiframe.failIfScriptTag' value='false'/>
But please, use the tbroyer plugin, it's much better, makes no sense start a new project using the old one. I also think that using maven makes a pretty reasonable development lifecycle, I just use the IDE to run the maven goals, works perfectly, much easier to configure and get it work. The tbroyer archetype can be used, gwt don't make sense to be executed in debug mode, and the sever side, tomcat, can be executed as develop maven goal and works in eclipse and IntelliJ.
Magnus, if you still have a problem to run it - I can create a small "hello world" to show you how to do that with maven
--
I am happy to have a solution, but I wonder what was going on. Why istn't the newest plugin used by default? I have seen that there already is a version 3.0.0 of the plugin.
Should I hardcode the version in the pom.xml?
Friends,it seems as if I could solve the problem by adding this to the pom.xml:<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-war-plugin</artifactId><version>2.6</version></plugin>As you can see in the error message, version 2.2. is used by default. By changing it to 2.6 the error disappeared!I am happy to have a solution, but I wonder what was going on. Why istn't the newest plugin used by default? I have seen that there already is a version 3.0.0 of the plugin.
Should I hardcode the version in the pom.xml?
However, now that the error disappeared, I'll come back to the original question and see how it speeds up the development process.
However, now that the error disappeared, I'll come back to the original question and see how it speeds up the development process.Now that you can have "resolve dependencies from the workspace" enabled in Eclipse, the GWT Eclipse Plugin should automatically configure the launch configuration to use the Eclipse project for the library and its source folders; that means you don't need to "mvn install" and restart the dev mode. So, problem solved?
(and with a reactor build, using and configuring net.ltgt.gwt.maven:gwt-maven-plugin:devmode in the root project, you get a similar behavior, from the command line)
--
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+unsub...@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.