You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Rob Wilson <ne...@gmail.com> on 2007/11/09 12:21:41 UTC

Checking whether a property is set

I can check whether a file exists and set a property, but can I check
whether a property exists and set a property based on whether it
exists?

I don't mind how this is checked, I just need to make sure that my
JUnit test stops if the property isn't set.

Cheers,
Rob.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


RE: Checking whether a property is set

Posted by "Rebhan, Gilbert" <Gi...@huk-coburg.de>.
 
-----Original Message-----
From: Rob Wilson [mailto:netplay@gmail.com] 
Sent: Friday, November 09, 2007 12:22 PM
To: Ant Users List
Subject: Checking whether a property is set

/*
I can check whether a file exists and set a property, but can I check
whether a property exists and set a property based on whether it
exists?

I don't mind how this is checked, I just need to make sure that my
JUnit test stops if the property isn't set.
*/

you can call  your target with unless

<target name="runJUnit" unless="yourproperty">
...

so it runs only when yourproperty is not set

also possible =
<target name="runJUnit">
<if> 
  <isset property="yourproperty"/> ...
  <then>
  ...
  </then>
  <else>
 ...
  </else>
</if>
</target>



Regards, Gilbert



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Checking whether a property is set

Posted by Peter Reilly <pe...@gmail.com>.
   <condition property="abc.not.set">
     <not><isset property="abc"/></not>
  </condition>



On Nov 9, 2007 11:21 AM, Rob Wilson <ne...@gmail.com> wrote:
> I can check whether a file exists and set a property, but can I check
> whether a property exists and set a property based on whether it
> exists?
>
> I don't mind how this is checked, I just need to make sure that my
> JUnit test stops if the property isn't set.
>
> Cheers,
> Rob.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org