ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rebhan, Gilbert" <Gilbert.Reb...@huk-coburg.de>
Subject RE: ANT / AntXtras quick question.
Date Tue, 18 Sep 2007 13:40:20 GMT
Hi, 

-----Original Message-----
From: Rebhan, Gilbert [mailto:Gilbert.Rebhan@huk-coburg.de] 
Sent: Tuesday, September 18, 2007 3:05 PM
To: user@ant.apache.org
Subject: RE: ANT / AntXtras quick question.

/*
 <!-- make sure the property is a string of chars, will return
    false if it's set to 12345 or also if property is an empty string ""
-->
<assert matches="\w+" property="testproperty"/>
  */

forget this nonsense, had a visit to the dentist that morning ;-)
  
Of course \w+ would match all aplhanumeric chars, means
[a-zA-Z_0-9]

so you go like that =

<project name="bla" default="main" basedir=".">
  <!-- // Taskdefs -->
  <!-- Import AntXtras -->
  <taskdef resource="com/idaremedia/antx/install/antlib.xml"/>
  <!-- Taskdefs // -->

  <!-- // Properties -->
  <property name="testproperty" value="foobar"/>
  <!-- Properties // -->

    <target name="depends">

<!-- assure the property isset -->
<assert isset="testproperty"/>
<!-- assure the property isset and not empty -->
<assert notequals="" property="testproperty" msg="Property empty !!"/>
      
      <echo>
        Yup, $${testproperty} set to ${line.separator} =>
${testproperty}
      </echo>
        
    </target>

    <target name="main" depends="depends"/>
</project>

means all you need is one assert =
<assert notequals="" property="testproperty"/>

true if property ain't empty, so it must also be set

I'm no expert for AntXtras, see the UserGuide and
QuickStart for other stuff.


Regards, Gilbert


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


Mime
View raw message