File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Ant, Maven and Other Build Tools and the fly likes ant script not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "ant script not working" Watch "ant script not working" New topic
Author

ant script not working

Pradeep Kumar
Ranch Hand

Joined: Sep 11, 2007
Posts: 77
Hi,
I have a batch file in the current base directory. I tried running the batch file using the following command.

<?xml version="1.0" encoding="UTF-8"?>
<project name="batchFile" default="exec" basedir=".">
<target name="exec">
<echo>start execution</echo>
<exec dir="${basedir}" executable="batch" os="Windows NT">
<arg line="stop_copy_start"/>
</exec>

</target>
</project>

The echo is getting executed but there is no warning error or any intimation but the Build successfull message is getting displayed.
Can someone tell me how to run the batch file. THe os is windows xp service pack 2.

Thanks and regards,
Pradeep Kumar


SCJP 1.6
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Did you check the value of the "os.name" property?


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Pradeep Kumar
Ranch Hand

Joined: Sep 11, 2007
Posts: 77
How and where to test the os.name property.
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Just add a

<echo>${os.name}</echo>

to your script. The shown value is the one you should use for the os attribute of the exec task. Or perhaps you should use the osfamily attribute instead.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: ant script not working