Take the 2-minute tour ×

I'm using an Ant task to invoke Google's GWT compiler, as in:

 <arg value="package.of.GWTClass" />

This works, but I'd like to avoid recompiling the entire project during each Ant build in none of the dependencies have changed. I'm aware that Ant can't automatically track these dependencies, but is there any way for me to manually encode them, and selectively skip the target when nothing has changed?

share|improve this question
add comment

3 Answers

You could also consider attempting to parallelise the GWT compile step in your ANT build with the java compilation. We used ANT's tag to run the GWT compile step alongside the standard java compilation step. Clearly this will only really help if your computer is has more than one core.


        <antcall target="gwt-compile"/>
            <antcall target="compile/java"/>
            <antcall target="compile/test-unit"/>
            <antcall target="compile/test-integration"/>
            <antcall target="compile/test-gwt"/>
            <antcall target="compile/test-selenium"/>

We also defined module files that targetted just the Firefox browser for running the tests part of the build (for our check in buid), and then also a more complete module file with all browsers supported for the full build on the Continuous Integration build.

share|improve this answer
add comment

You may add an if clause to your ant target. We use it as follows:

<target name="gwt-compile" if="gwt" description="Compile GWT related code.">
    <!-- ... -->

When you invoke the target you can enable the compilation by setting the gwt property with -D:

ant -Dgwt=yes gwt-compile

The opposite of if in a target is unless.

Hope that helps.

share|improve this answer
add comment

use the uptodate task in conjunction with gwt. What it does is check if a file is more recent than another file, and sets a property if it is. You compare the gwt source file with the *.js output files' dates, and if its more recent, you do the compile.

you will have to get all the files the gwt compiler will use, which can be hard if you only have a module name, and cannot work out the inheritance tree easily, but a simple but not always optimal approach would be to just use every gwt java file. Then, in the gwt compile task, check the property before compiling.

share|improve this answer
add comment

Your Answer


