Jeroen,

 

Change this

<if test="${target::exists('${bin}')}">

 

to

 

<if test="${directory::exists(bin)}">

 

 

The following script shows how to use the target function:

 

<?xml version="1.0"?>

<project name="App" default="test">

    <property name="bin" value="build\bin"/>
    <property name="nameTarget" value="Name" />

    <target name="test">

        <if test="${target::exists(nameTarget)}">
            <echo message="target exists"/>
        </if>

        <if test="${directory::exists(bin)}">
            <echo message="directory exists"/>
        </if>

    </target>


    <target name="Name">
    </target>


</project>

 

 

 

 

Noel

 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Jeroen Stiekema
Sent: Wednesday, May 19, 2004 1:09 AM
To: [EMAIL PROTECTED]
Subject: [Nant-users] <if> task to test a target won't work

 

Hi,

 

I have a problem with the usage of the <if> task. I would like to test if a target exists. If the target exists, the target will be deleted.

 

<if test="${target::exists('${bin}')}">

      <echo message="target exists"/>

      <delete dir="${bin}"/>

</if>

 

The ‘bin’ property is set to build\bin. I’m 100% sure the target exists, but the test will return false, so the if task won’t run.

When I test the output of ‘target::exists(“build”)’ it also says ‘false’ (<echo message=”${target::exists(‘build’)}”/>). The directory ‘build’ does exists.

Can anyone tell me what I’m doing wrong?

Thanks in advance!

 

Jeroen

Reply via email to