HOW-TO: Super Dev Mode, Ant, and Run-Jetty-Run

699 views
Skip to first unread message

Thad Humphries

unread,
Jul 30, 2014, 11:52:35 AM7/30/14
to google-we...@googlegroups.com

Though I've moved to Super Dev Mode for new projects, and have been trying out Maven and Gradle, I have two shipping products that are built with Ant and were developed using DevMode. I'm reluctant to screw with these much, but I must fix the occasional bug or tweak or add a feature. This summer I've had to reopen both projects, and decided that I might as well move them from GWT 2.5.1 to 2.6.1 and get them working with Super Dev Mode.

It ends up that Super Dev Mode was pretty easy. First I added the xsiframe linker to the module files. My projects' build.xml scripts were first built with GWT's webAppCreator (one back in GWT v1.something). I copied their devmode targets and modified them for SDM. Except for the last <arg>, the sdm target for both projects is the same:

<target name="sdm" depends="javac" description="Run Super Dev Mode">
  <java failonerror="true" fork="true"
 
        classname="com.google.gwt.dev.codeserver.CodeServer">
    <classpath>
      <pathelement location="src"/>
      <path refid="project.class.path"/>
      <pathelement location="${gwt.sdk}/validation-api-1.0.0.GA.jar" />
      <pathelement location="${gwt.sdk}/validation-api-1.0.0.GA-sources.jar" />
      <pathelement path="${gwt.sdk}/gwt-codeserver.jar" />
    </classpath>
    <jvmarg value="-Xmx512M"/>
    <arg value="-bindAddress"/>
    <arg value="0.0.0.0"/>
    <arg value="-port"/>
    <arg value="9876"/>
    <arg value="-workDir"/>
    <arg value="workDir"/>
    <arg line="-src"/>
    <arg value="src"/>
    <!-- Additional arguments like -style PRETTY or -logLevel DEBUG -->
    <arg value="com.optix.cold.Cold"/>
  </java>
</target>

While I could continue to use DevMode to run my projects in Jetty, I'd like to avoid DevMode altogether (maybe it will go away in some future GWT?). First I tried an Ant target, but I had no success when following the instructions. With a little searching, I found the Eclipse plugin Run Jetty Run. Success. With Run Jetty Run installed, the Jetty Webapp run/debug configuration builds itself when you highlight the project, right click, and select Run As -> Run Jetty (you can tweak this later; I prefer to run development on port 8888). Run picks up the app's war/WEB-INF/jetty-web.xml so it is easy to modify the web app context. 

With this set up, I start the webapp under Jetty though Eclipse, and run `ant sdm` in a console. I already have the Dev Mode On/Off buttons in my bookmarks toolbar, so I point Chrome at http://localhost:8888/cold and press Dev Mode On. Voila! I can debug the client side with Chrome's developer tools and debug the server side in Eclipse. Moreover, when I make a source code change on the server side, I don't have to restart the server. Run Jetty Run picks up the change in seconds. (Chrome only. Alas, while I can see the client side Java in Firefox 31, it's entirely alphabetical by filename, and the codeserver debugger does not honor breakpoints.)

Reply all
Reply to author
Forward
0 new messages