ant 的 build.xml怎么手动执行,
就像在eclipse中使用菜单“run as >> ant build”一样?

解决方案 »

  1.   

    build.xml不是执行文件,是配置文件,ant才是执行文件,直接敲就是了,如需ant顺利执行,当前就得有build.xml文件 
      

  2.   

    手动执行?安装ant,命令行里面直接ant 
    算不算你说的手动?
      

  3.   

    <target name="help">
    <echo message="Please specify a target![usage: ant &lt;targetname&gt;]" />
    <echo message="Here is a list of possible target:" />
    <echo message="clean   ...... Delete build dir,class dir,dist dir" />
    <echo message="init    ...... Prepare the nesseray dir for the next work" />
    <echo message="compile ...... Compile all the src files" />
    <echo message="build   ...... Create the war file" />
    <echo message="deploy  ...... Deloy the war file to web server" />
    <echo message="jar     ...... Create jar file of this application" />
    <echo message="javadoc ...... Generates javadoc for this application"/>
    </target> <target name="clean" description="">
    <delete dir="${class.home}" />
    <delete dir="${build.home}" />
    <delete dir="${dist.home}" />
    <delete dir="${doc.home}" />
    </target> <target name="init" depends="clean" description="">
    <!-- Create Time Stamp -->
    <tstamp/>
    <!-- Make directory for build -->
    <mkdir dir="${class.home}" />
    <mkdir dir="${build.home}" />
    <mkdir dir="${build.home}/WEB-INF" />
    <mkdir dir="${build.home}/WEB-INF/classes" />
    <mkdir dir="${build.home}/WEB-INF/lib" />
    <mkdir dir="${dist.home}" />
    </target>
     比如说想要执行clean命令,那么在命令行中可以这样
     ant help
      

  4.   

    <target name="help"> 
    <echo message="Please specify a target![usage: ant &lt;targetname&gt;]" /> 
    <echo message="Here is a list of possible target:" /> 
    <echo message="clean   ...... Delete build dir,class dir,dist dir" /> 
    <echo message="init    ...... Prepare the nesseray dir for the next work" /> 
    <echo message="compile ...... Compile all the src files" /> 
    <echo message="build   ...... Create the war file" /> 
    <echo message="deploy  ...... Deloy the war file to web server" /> 
    <echo message="jar     ...... Create jar file of this application" /> 
    <echo message="javadoc ...... Generates javadoc for this application"/> 
    </target> <target name="clean" description=""> 
    <delete dir="${class.home}" /> 
    <delete dir="${build.home}" /> 
    <delete dir="${dist.home}" /> 
    <delete dir="${doc.home}" /> 
    </target> <target name="init" depends="clean" description=""> 
    <!-- Create Time Stamp --> 
    <tstamp/> 
    <!-- Make directory for build --> 
    <mkdir dir="${class.home}" /> 
    <mkdir dir="${build.home}" /> 
    <mkdir dir="${build.home}/WEB-INF" /> 
    <mkdir dir="${build.home}/WEB-INF/classes" /> 
    <mkdir dir="${build.home}/WEB-INF/lib" /> 
    <mkdir dir="${dist.home}" /> 
    </target> 

     比如说想要执行clean命令,那么在命令行中可以这样写:
     ant clean
      

  5.   

    进入命令窗口 > 走到build.xml目录下 执行ant