ant之exec应用

exec官方文档:http://ant.apache.org/manual/Tasks/exec.html

 

贴一个别人写的build.xml,看完自然就明白了。

 

<?xml version="1.0"?>

<!-- ANT build file to test a specific feature or bug of ANT.
     Dominique Devienne <[email protected]>      January 2003
  -->
<project name="antx" default="test">

  <target name="test">
    <!-- This doesn't return immediately, but starts IE
    <exec vmlauncher="false"
          executable="C:\Program Files\Internet Explorer\IEXPLORE.EXE">
    </exec>
      -->

    <!-- This opens a DOS window, not even launching IE, nor returning
    <exec vmlauncher="false" executable="cmd.exe">
      <arg line="/c start" />
      <arg value="C:\Program Files\Internet Explorer\IEXPLORE.EXE" />
    </exec>
      -->

    <!-- This opens a DOS window, not even launching IE, nor returning
    <exec vmlauncher="false" executable="start">
      <arg value="C:\Program Files\Internet Explorer\IEXPLORE.EXE" />
    </exec>
      -->

    <!-- This doesn't return immediately, but starts IE, as expected
    <exec vmlauncher="true"
          executable="C:\Program Files\Internet Explorer\IEXPLORE.EXE">
    </exec>
      -->

    <!-- This opens a DOS window, not even launching IE, nor returning
    <exec vmlauncher="true" executable="cmd.exe">
      <arg line="/c start" />
      <arg value="C:\Program Files\Internet Explorer\IEXPLORE.EXE" />
    </exec>
      -->

    <!-- This hangs Ant 'inside' the CMD shell started...
    <exec vmlauncher="true" executable="cmd.exe">
      <arg line="/c start /B" />
      <arg value="C:\Program Files\Internet Explorer\IEXPLORE.EXE" />
    </exec>
      -->

    <!-- This fails, since there's no start program of course
    <exec vmlauncher="true" executable="start">
      <arg value="C:\Program Files\Internet Explorer\IEXPLORE.EXE" />
    </exec>
      -->

    <!-- This opens a DOS window, not even launching IE, nor returning
         P:\org_apache\antx>type cmd-spawn.bat
         start %*
    <exec vmlauncher="false" executable="cmd-spawn.bat">
      <arg value="C:\Program Files\Internet Explorer\IEXPLORE.EXE" />
    </exec>
      -->

    <!-- This hangs Ant 'inside' the CMD shell started...
         P:\org_apache\antx>type cmd-spawn.bat
         start /B %*
    <exec vmlauncher="false" executable="cmd-spawn.bat">
      <arg value="C:\Program Files\Internet Explorer\IEXPLORE.EXE" />
    </exec>
      -->

    <echo message="Launched IE" />
  </target>

</project> 

你可能感兴趣的:(exec)