Running a BAT file from ANT

2020-07-02 12:18发布

I have gone through number of posts on the very forum but couldn't sort it out. I am trying to run a BAT file from ANT script. The folder hierarchy is like this

- Project
| - build.xml
| - build-C
| | - test.bat

The ANT file that i wrote so for is

<project name="MyProject" basedir=".">
    <property name="buildC" value="${basedire}\build-C" />

    <exec dir="${buildC}" executable="cmd" os="Windows XP">
        <arg line="/c test.bat"/>
    </exec>
</project>

The bat file content is

echo In Build-C Test.bat

It says that build failed .. :s i dun know what wrong am i doing ?

1条回答
够拽才男人
2楼-- · 2020-07-02 12:31
<property name="buildC" value="${basedire}\build-C" />

This should be ${basedir} I guess? Use

<echo>${buildC}</echo>

to make sure the dir is correct.

And shouldn't

<exec dir="${buildC}" executable="test.bat" os="Windows XP" />

do the job?

查看更多
登录 后发表回答