first ant program

来源:互联网 发布:excel办公软件使用 编辑:程序博客网 时间:2024/05/18 16:54
<?xml version="1.0"?>
<project name="helloWorld" default="run" >
<property name="name" value="amigo"/>
<property name="age" value="25"/>
<target name="sayBaseDir">
              <echo message="The base dir is: ${basedir}"/>
              <echo message="The age is: ${age}"/>
       </target>
       <target name="sayHelloWorld" depends="sayBaseDir">
              <echo message="Hello,IAN"/>
       </target>
       <target name="buildClass" depends="sayHelloWorld">
              <javac srcdir="." destdir="." includeAntRuntime="false"/>
       </target>
       <target name="mkfolder" depends="buildClass">
              <mkdir dir="build/classes"/>
       </target>
       <target name="movefile" depends="mkfolder">
              <move todir="build/classes">
              <fileset dir="." includes="*.class"/>
              </move>
       </target>
       <target name="run" depends="movefile">
      <java classname="Helloworld">
          <classpath>
             <pathelement path="build/classes"/>
          </classpath>
      </java>
    </target>
</project>
0 0
原创粉丝点击