You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by gglefoncede gglefoncede <gg...@hotmail.com> on 2003/12/09 17:59:55 UTC

Condition If

Hi all

I would like to know if it's possible to execute a task only if the task 
that it depends was succesfull ?
In fact I've got a task that create a directory on my server and another 
that upload Files in this directory. And if the directory i try to create 
already exists, there is a error but the second task is executed.
I would like that the ANT script stop when a task failed.

This is my 2 tasks:

<target name="CreateDir">
		<ftp action="mkdir"
       			server="${properties.ftp.adresseserveur}"
       			userid="${properties.ftp.utilisateur}"
       			password="${properties.ftp.password}"
       			remotedir="${properties.rep.sitemaquette}"/>
</target>

<target name="FTP" depends="CreationDir">
		<ftp server="${properties.ftp.adresseserveur}"
			remotedir="${properties.rep.sitemaquette}"
       			userid="${properties.ftp.utilisateur}"
       			password="${properties.ftp.password}">
		   <fileset dir="${properties.rep.temporaire}">
			<exclude name="scriptsql/**"/>
		   </fileset>
  		</ftp>
</target>


I would like something like

If (Directory already exists) then
     Delete the diretory
     Create the directory
     Execute the FTP task
else
     Create the directory
     Execute the FTP task
end if


How could i do that ??????


Thanks
Greg

_________________________________________________________________
MSN Messenger  http://g.msn.fr/FR1001/866 : un logiciel gratuit pour 
dialoguer avec vos amis !


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


RE: Condition If

Posted by Bret Kumler <bk...@firstam.com>.
Get the ant-contrib-0.5.jar

-----Original Message-----
From: gglefoncede gglefoncede [mailto:gglefoncede@hotmail.com]
Sent: Tuesday, December 09, 2003 9:00 AM
To: user@ant.apache.org
Subject: Condition If


Hi all

I would like to know if it's possible to execute a task only if the task 
that it depends was succesfull ?
In fact I've got a task that create a directory on my server and another 
that upload Files in this directory. And if the directory i try to create 
already exists, there is a error but the second task is executed.
I would like that the ANT script stop when a task failed.

This is my 2 tasks:

<target name="CreateDir">
		<ftp action="mkdir"
       			server="${properties.ftp.adresseserveur}"
       			userid="${properties.ftp.utilisateur}"
       			password="${properties.ftp.password}"
       			remotedir="${properties.rep.sitemaquette}"/>
</target>

<target name="FTP" depends="CreationDir">
		<ftp server="${properties.ftp.adresseserveur}"
			remotedir="${properties.rep.sitemaquette}"
       			userid="${properties.ftp.utilisateur}"
       			password="${properties.ftp.password}">
		   <fileset dir="${properties.rep.temporaire}">
			<exclude name="scriptsql/**"/>
		   </fileset>
  		</ftp>
</target>


I would like something like

If (Directory already exists) then
     Delete the diretory
     Create the directory
     Execute the FTP task
else
     Create the directory
     Execute the FTP task
end if


How could i do that ??????


Thanks
Greg

_________________________________________________________________
MSN Messenger  http://g.msn.fr/FR1001/866 : un logiciel gratuit pour 
dialoguer avec vos amis !


---------------------------------------------------------------------
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