Created
June 11, 2020 20:35
-
-
Save jeffjohnson9046/b89b2d62135d5e954c6a700318191a12 to your computer and use it in GitHub Desktop.
A quick test of condition elements in ant
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<project name="condition-test" default="all"> | |
<target name="condition"> | |
<condition property="isTomcat"> | |
<matches pattern="^(tomcat)" string="${webContainer}" /> | |
</condition> | |
<condition property="isWebLogic"> | |
<matches pattern="^(web)" string="${webContainer}" /> | |
</condition> | |
</target> | |
<target name="all" depends="condition"> | |
<echo message="the value of webContainer is ${webContainer}"/> | |
<echo message="isTomcat = ${isTomcat}"/> | |
<echo message="isWebLogic = ${isWebLogic}"/> | |
</target> | |
</project> | |
# Test: | |
$ ant -f ant-condition-test.xml -DwebContainer=tomcat | |
Buildfile: /Users/jeff.johnson/dev/ant-condition-test.xml | |
condition: | |
all: | |
[echo] the value of webContainer is tomcat | |
[echo] isTomcat = true | |
[echo] isWebLogic = ${isWebLogic} | |
BUILD SUCCESSFUL | |
Total time: 0 seconds | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment