I would like do not call some target in build.xml only in case if there is some variable on enrironment.
Following code does not work:
<property environment="env"/>
<property name="app.mode" value="${env.APP_MODE}"/>
<target name="someTarget" unless="${app.mode}">
...
</target>
<target name="all" description="Creates app">
<antcall target="someTarget" />
</target>
Target "someTarget" executes regardless of whether there is environment variable APP_MODE or not.
PS.
We use Ant 1.7.0.
UPDATE:
Question was corrected.
ANSWER:
Use unless="app.mode", but not unless="${app.mode}".
http://ant.apache.org/manual/properties.html#if+unless
In Ant 1.7.1 and earlier, these attributes could only be property names.
As of Ant 1.8.0, you may instead use property expansion; a value of true (or on or yes) will enable the item, while false (or off or no) will disable it.
Other values are still assumed to be property names and so the item is enabled only if the named property is defined.