You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Trent Ohannessian <to...@gmail.com> on 2006/05/03 21:31:41 UTC
Am I completely misunderstanding the fail/unless task?
Hey all,
I'm trying to error the build if a command line parameter isn't passed in.
This seems simple enough but it's not working as I anticipated and I still
don't get why this isn't working after reading through several docs. Here
is the command line call:
webtest -Denv=dev -buildfile webtest.xml
And here is the first portion of the buildfile:
<project name="InstallationCheck" basedir="." default="login">
<fail unless="${env}" >
Missing environment parameter.
Here is env: ${env}
Usage:
webtest -buildfile webtest.xml -Denv=[dev | qa | stg | prod]
</fail>
...
I assumed that would fail only if ${env} wasn't present. Notice how I print
out ${env} in the failure message. Now, here is the output when this
buildfile is run with the command line call from above:
Buildfile: webtest.xml
BUILD FAILED
D:\Open Source Projects\Canoo Web Test\my_tests\webtest.xml:3: Missing
environment parameter.
Here is env: dev
Usage:
webtest -buildfile webtest.xml -Denv=[dev | qa | stg | prod]
Total time: 0 seconds
How can this be failing when when env is printed out in the failure message?
Re: Am I completely misunderstanding the fail/unless task?
Posted by Trent Ohannessian <to...@gmail.com>.
Perfect. Thanks!
On 5/3/06, Robert Clark <ro...@quest.com> wrote:
>
> On Wednesday May 3, 2006 15:31, "Trent Ohannessian" <to...@gmail.com>
> wrote:
>
> > <fail unless="${env}" >
> >
>
> > BUILD FAILED
> > D:\Open Source Projects\Canoo Web Test\my_tests\webtest.xml:3:
> > Missing environment parameter.
> >
> > Here is env: dev
> >
> > Usage:
> > webtest -buildfile webtest.xml -Denv=[dev | qa |
> > stg | prod]
> >
> > Total time: 0 seconds
> >
> > How can this be failing when when env is printed out in the failure
> > message?
>
> The "unless" attribute of the <fail/> task takes the name of a
> property, not its value. In this case you need to re-write the test
> as:
>
> <fail unless="env">
> ....
> </fail>
>
> - Rob
>
>
--
Learn from the mistakes of others. You can't live long enough to make them
all yourself.
Re: Am I completely misunderstanding the fail/unless task?
Posted by Robert Clark <ro...@quest.com>.
On Wednesday May 3, 2006 15:31, "Trent Ohannessian" <to...@gmail.com>
wrote:
> <fail unless="${env}" >
>
> BUILD FAILED
> D:\Open Source Projects\Canoo Web Test\my_tests\webtest.xml:3:
> Missing environment parameter.
>
> Here is env: dev
>
> Usage:
> webtest -buildfile webtest.xml -Denv=[dev | qa |
> stg | prod]
>
> Total time: 0 seconds
>
> How can this be failing when when env is printed out in the failure
> message?
The "unless" attribute of the <fail/> task takes the name of a
property, not its value. In this case you need to re-write the test
as:
<fail unless="env">
....
</fail>
- Rob
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org