Вы можете попробовать использовать этот образец:
<scriptdef name="intCompare" language="javascript">
<attribute name="leftside"/>
<attribute name="rightside"/>
<attribute name="diff"/>
<![CDATA[
var leftSide = attributes.get("leftside");
var rightSide = attributes.get("rightside");
project.setProperty(attributes.get("diff"), leftSide-rightSide);
]]>
</scriptdef>
<target name="test">
<intCompare leftside="555" rightside="9" diff="deviation"/>
<echo message="The difference is: ${deviation}"/>
</target>