开发者

build.xml in ant

开发者 https://www.devze.com 2023-01-03 08:29 出处:网络
Can anybody help me know what these tags do in build.xml file? 1)<property file=\"\" location=\".\"/>

Can anybody help me know what these tags do in build.xml file?

1)<property file="" location="."/>
2)<property environment=""/>
3)<property name="" value=""/> 
4)<path> id="classpath.base"
5)<开发者_JAVA技巧;pathelement> location="$some.jar"/> 
6)<path> id="classpath.build"> 
7)<path> id="classpath.test">
8)<target></target>

Thank You


In the interest of teaching a man how to fish, here're the docs for the <property> tag and the <path> and <pathelement> tags.


<property environment=""/> is system environment variable
<property name="" value=""/> is define variable with value

The location attribute specifies a single file or directory relative to the project's base directory (or an absolute filename), while the path attribute accepts colon- or semicolon-separated lists of locations. The path attribute is intended to be used with predefined paths - in any other case, multiple elements with location attributes should be preferred.

Targets contain task elements. Each task element of the buildfile can have an id attribute and can later be referred to by the value supplied to this

<project name="MyProject" default="dist" basedir=".">
    <description>
        simple example build file
    </description>
  <!-- set global properties for this build -->
  <property name="src" location="src"/>
  <property name="build" location="build"/>
  <property name="dist"  location="dist"/>

  <target name="init">
    <!-- Create the time stamp -->
    <tstamp/>
    <!-- Create the build directory structure used by compile -->
    <mkdir dir="${build}"/>
  </target>

  <target name="compile" depends="init"
        description="compile the source " >
    <!-- Compile the java code from ${src} into ${build} -->
    <javac srcdir="${src}" destdir="${build}"/>
  </target>

  <target name="dist" depends="compile"
        description="generate the distribution" >
    <!-- Create the distribution directory -->
    <mkdir dir="${dist}/lib"/>

    <!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
    <jar jarfile="${dist}/lib/MyProject-${DSTAMP}.jar" basedir="${build}"/>
  </target>

  <target name="clean"
        description="clean up" >
    <!-- Delete the ${build} and ${dist} directory trees -->
    <delete dir="${build}"/>
    <delete dir="${dist}"/>
  </target>
</project>
0

精彩评论

暂无评论...
验证码 换一张
取 消