By default GWT4NB recompiles all of your client code with the GWT compiler whether or not you’ve changed it. This is a time consuming (and sometimes irritating factor). After a recent discussion on the GWT dev mailing list (which I was away for most of), I decided to post the solution I use here and on the mailing list.
In your projects build.xml, just copy-and-paste the following:
<target name="-post-compile">
<property name="output.js" location="${build.web.dir}/${gwt.module}/${gwt.module}.nocache.js" />
</target>
<target name="debug" description="Debug project in IDE." depends="init,compile,compile-jsps,-do-compile-single-jsp" if="netbeans.home">
<property name="gwt.compile.unneeded" value="true" />
<antcall target="dist"/>
<nbdeploy debugmode="true" clientUrlPart="${client.urlPart}"/>
<antcall target="connect-debugger"/>
<antcall target="debug-connect-gwt-shell"/>
</target>
<target name="-pre-dist">
<condition property="gwt.compile.unneeded">
<and>
<available file="${output.js}" />
<uptodate>
<srcfiles dir="${src.dir}" includes="**/client/**/*.java" />
<mergemapper to="${output.js}" />
</uptodate>
</and>
</condition>
<antcall target="do-gwt-compile" />
</target>
<target name="do-gwt-compile" unless="gwt.compile.unneeded">
<!-- You can override this property in the 'gwt.properties' file -->
<property name="gwt.compiler.output.style" value="OBFUSCATED"/>
<property name="gwt.compiler.logLevel" value="WARN"/>
<java classpath="${javac.classpath}:${src.dir}" failonerror="true"
classname="com.google.gwt.dev.GWTCompiler" fork="true" maxmemory="512m">
<arg value="-out"/>
<arg path="${build.web.dir}/"/>
<arg value="-style"/>
<arg value="${gwt.compiler.output.style}"/>
<arg value="-logLevel"/>
<arg value="${gwt.compiler.logLevel}"/>
<arg value="${gwt.module}"/>
</java>
<property name="gwt.output.dir" value="${gwt.module}"/>
<move todir="${build.web.dir}/${gwt.output.dir}">
<fileset dir="${build.web.dir}/${gwt.module}"/>
</move>
</target>
What does it actually do? It checks to see if the client side code is newer than the module.nocache.js file in the web output. Since GWT overwrites this file every-time it compiles (and in GWT 1.5 actually deletes it first), it will only be older if one of your source files has changed.
Hope this helps you out, happy coding!
Edit 11/14/08: The script is now fixed to only build using normal javac when run in debugging mode.

