Chenge the behavior of the gwtDev task
Right now the gwtDev task will launch and wait for the IDE to connect to the debug port . After the IDE attaches to the debug port, the gradle process for the gwtDev task will still not finish - I guess the intention is that one can stop gwtDev by killing the blocked gradle process. However this is unnecessary and only wastes memory (for the blocked gradle process). Instead:
- Launch the gwtDev by spawning a separate JVM and do not make it wait for an incoming debug connection
- Let the gradle process finish as usual. If one needs to kill Dev Mode, s/he can easily do it as it is just an UI with close window button, usually at the top-right corner. No need to hold the gradle process.
Below is a an example of implementing this behavior without the plug-in. (Note the use of Ant's java task with spawn and fork attributes, as there is a long-standing bug in Gradle that does not allow you to spawn processes independent of the Gradle process).
//This would start the GWT code server and immediately finish .. which is OK since Dev Mode can be killed easily task startGwt << { description = "Launch GWT DevMode for all gwt modules" ant.java( spawn:true, fork:true, classname:"com.google.gwt.dev.DevMode"){ jvmarg(value: "-Djava.util.logging.config.file=${project.webInfDir}/logging.properties") //RestEasy logging jvmarg(value: "-Xmx1024m") jvmarg(value: "-Xss1024k") jvmarg(value: "-XX:PermSize=1024m") jvmarg(value: "-XX:MaxPermSize=1024m") jvmarg(value: "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005") arg(value: "com.bla.WebApp") //arg(line: "-startupUrl index.jsp") arg(line: "-startupUrl s4g-web/index.jsp") arg(line: "-war "+project.warDir) arg(line: "-noserver") arg(line: "-port 8080") arg(line: "-codeServerPort 9997") arg(line: "-extra "+ project.gwtExtraDir) arg(line: "-logLevel INFO") classpath { pathElement(location: "src/main/java") pathElement(location: "src/main/resources") pathElement(location: "${project.webClassesDir}") pathElement(path: configurations.gwt.asPath) pathElement(path: configurations.compile.asPath) pathElement(path: configurations.providedCompile.asPath) } } }
I hope I understood the problem right .... When starting gwtDev, the dev mode window will appear at some time. If I remember right, the gradle process terminates if you close that window. That should also be the case if a debugger is attached to this process.
It is intended behavior that the gradle process runs while gwtDev runs. This makes it possible to log to the attaches console. If a background process would be spawned it would either cause another console window to open or the log would be lost.
What would be helpfull in my point of view is the possibility to kill running gradle tasks out of the IDE. But unfortunately there's a bug in Gradle that prevents IDE developers to do that: http://issues.gradle.org/browse/GRADLE-1539
Let me try to explain again:
- there is no need to keep the gradle process running once you launched dev mode. This results in memory waste only.
- gwt dev has its own console where all errors/exception show (this is one of the tabs of the UI) , so none of the log messages would be lost and there is no need to keep the gradle console for that.
- It is very easy to kill the gwt dev process without the parent gradle process - just click on the [X] control of the gwt dev window and it dies immediately.
My point is that there is really no need to keep the parent gradle process once you launched gwt dev.
Only Client only log messages (GWT.log/TreeLoggerStuff) are shown in the DevMode window (yes I know where to find it). The important part here is server side logging. These logs would get lost if changing the behavior this way.
If I remember right, client side logging via java.util.logging will also not be shown in the DevMode window. If using remote logging you would expect to see those log messages in the console window or Eclipse.
As the gwt-maven-plugin implements the exact same behavior I would also treat it as default behavior.
What if one does not use the built-in jetty server at all? Perhaps the best way isbtoballow the user to either spawn or not gwtdev... On Dec 4, 2013 3:04 AM, "steffenschaefer" [email protected] wrote:
Only Client only log messages (GWT.log/TreeLoggerStuff) are shown in the DevMode window (yes I know where to find it). The important part here is server side logging. These logs would get lost if changing the behavior this way.
If I remember right, client side logging via java.util.logging will also not be shown in the DevMode window. If using remote logging you would expect to see those log messages in the console window or Eclipse.
As the gwt-maven-plugin implements the exact same behavior I would also treat it as default behavior.
— Reply to this email directly or view it on GitHubhttps://github.com/steffenschaefer/gwt-gradle-plugin/issues/4#issuecomment-29796212 .
For the record -> This is related to http://issues.gradle.org/browse/GRADLE-1254
I know and I asked the gradle team when this be fixed. In the meantime, the workaround is to use Ant's exec task as I showed you with the snippet of Gragle/ant code. Ant's exec can spawn and works well and all Ant tasks are automatically available in Cradle. On Dec 4, 2013 12:05 PM, "steffenschaefer" [email protected] wrote:
For the record -> This is related to http://issues.gradle.org/browse/GRADLE-1254
— Reply to this email directly or view it on GitHubhttps://github.com/steffenschaefer/gwt-gradle-plugin/issues/4#issuecomment-29840038 .