Skip to content

Instantly share code, notes, and snippets.

Created June 11, 2020 20:35
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
A quick test of condition elements in ant
<project name="condition-test" default="all">
<target name="condition">
<condition property="isTomcat">
<matches pattern="^(tomcat)" string="${webContainer}" />
<condition property="isWebLogic">
<matches pattern="^(web)" string="${webContainer}" />
<target name="all" depends="condition">
<echo message="the value of webContainer is ${webContainer}"/>
<echo message="isTomcat = ${isTomcat}"/>
<echo message="isWebLogic = ${isWebLogic}"/>
# Test:
$ ant -f ant-condition-test.xml -DwebContainer=tomcat
Buildfile: /Users/jeff.johnson/dev/ant-condition-test.xml
[echo] the value of webContainer is tomcat
[echo] isTomcat = true
[echo] isWebLogic = ${isWebLogic}
Total time: 0 seconds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment