Reputation: 1089
My code:
<property environment="env"/>
<target name="detectTomcatFromEnv" unless="${env.CATALINA_HOME}">
<echo message="${env.CATALINA_HOME}"/>
</target>
I defined CATALINA_HOME and as I understand, target should not run.
But my result is:
detectTomcatFromEnv:
[echo] c:\apache-tomcat-7.0.21\
BUILD SUCCESSFUL
How it can be???
Upvotes: 1
Views: 484
Reputation: 18704
You need to remove the ${...}
from unless:
<property environment="env"/>
<target name="detectTomcatFromEnv" unless="env.CATALINA_HOME">
<echo message="${env.CATALINA_HOME}"/>
</target>
See https://ant.apache.org/manual/targets.html:
unless: the name of the property that must not be set in order for this target to execute, or something evaluating to false.
Upvotes: 3