Saving precious build time

August 30, 2009, Posted by admin at 11:54 am

Normally before deploying(copying) an app to the server to view changes/testing using ant, there are lots of stuffs being done. A lot of them might not been necessary since only a small change has been made in a file, therefore only that file need to be uploaded. If you are using xdoclet for struts, hibernate or other autogeneration needs, changes not related to the latter shouldn’t trigger all the xdoclet ‘magic’ stuff. To achieve that set a variable just before running the main ant task, e.g. deploy, by calling another helper task, in my case prepare. In prepare put in the below code, assuming you are generating webdoclet code such as struts-config.xml

<uptodate property="webdoclet.needed">
<srcfiles dir="${src.dir}" includes="**/*Action.java"/>
<mapper type="glob" from="*.java" to="../bin/*.class"/>
</uptodate>

At the webdoclet task, which copy depends on, fill the unless with the uptodate property

	<target name="webdoclet" unless="webdoclet.needed">

Straightaway, you are shaving a few seconds of your build time, which translates to a few minutes of the daily wait time and removing “let me get a cup of coffee while the build script runs” time wastage.

No comment yet.

Leave a Reply