Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Executing a BAT file using ANT

 
Pravin Durb
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am trying to execute a .BAT file using a simple ANT script.. I have embedded this script in my Cruisecontrol script as below.

<cruisecontrol>
<property name="deploy.bat.path" value="${base.dir}\cbs_hlp\deploy.bat"/>

<schedule>
<ant anthome= "C:\ant" target="${deploy.bat.path}"/>
</schedule>

</cruisecontrol>
I am hoping that ANT file will execute the BAT file when the Cruisecontrol build happens.. I have ANT installed under C:\ant..

Any ideas?

Thanks
[ October 13, 2008: Message edited by: Pravin Durb ]
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34422
347
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pravin,
The ant subtask of schedule sets up an ant file to be run. Since you want to run a batch file, you'll want to use the exec subtask instead.
 
Pravin Durb
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jeanne,
I have changed the script to use <exec> instead..but I still have the same problem

<schedule interval="30">
<composite>
<exec workingdir="C:\dev\tools\cruisecontrol-2.7.2" command="deploy.bat"/>
</composite>
</schedule>

Thanks
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are you hoping happens and what actually happens? What you have looks like it should work (assuming C:\dev\tools\cruisecontrol-2.7.2\deploy.bat exists).

What do the cruise control logs say?
 
Pravin Durb
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well..I am hoping that the deploy.BAT file will execute through cruise control because when I launch it from C:\dev\tools\cruisecontrol-2.7.2 it works fine..Yes, the bat file does exist in the directory

I checked the logs also, but I don't see any reference to the <exec> task being executed

Appreciate your help!

Thanks
 
Pravin Durb
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was able to get it to work..Thanks

<property name="deploy.bat.path" value="${base.dir}\cbs_hlp\deploy.bat"/>

<schedule interval="30">
<exec command="${deploy.bat.path}"/>
</schedule>

I had to remove <composite> for now. didn't realize that if one task fails then it won't execute the next one in line..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic