日期:2014-05-18  浏览次数:20629 次

在ant里能够调用一个bat文件吗
或者直接在ant里运行一些windows命令行里的命令。

------解决方案--------------------
可以的,在Windows下,不能直接调用dir、del(因为没有这个程序!)等,必须通过cmd.exe来调用:

<?xml version= "1.0 " ?>

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

<target name= "test ">

<exec executable= "cmd.exe ">

<arg line= "/c dir "/>

</exec>

</target>

</project>

------解决方案--------------------
既然给jar签名,为什么不用ant直接签名呢,不必调用bat
<signjar destDir= "signed "
alias= "testonly " keystore= "testkeystore "
storepass= "apacheant "
preservelastmodified= "true ">
<path>
<fileset dir= "dist " includes= "**/*.jar " />
</path>
<flattenmapper />
</signjar>