Reference ant.project.name : Properties « Ant « Java






Reference ant.project.name

 
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="build" name="Agnotion">
    <property name="JUNIT_HOME" value="eclipse/plugins/org.junit_3.8.1"/>
    <path id="project.classpath">
        <pathelement location="build/java"/>
        <pathelement location="build/test"/>
        <pathelement location="${JUNIT_HOME}/junit.jar"/>
    </path>

    <target name="init">
        <mkdir dir="build/test"/>
        <mkdir dir="build/java"/>
      <mkdir dir="dist"/>
    </target>

    <target name="clean">
        <delete dir="build/test"/>
        <delete dir="build/java"/>
        <delete dir="dist"/>
    </target>

    <target depends="init" name="build">
        <javac destdir="build/java">
            <src path="src/java"/>
            <classpath refid="project.classpath"/>
        </javac>
        <javac destdir="build/test">
            <src path="src/test"/>
            <classpath refid="project.classpath"/>
        </javac>
    </target>

  <target name="dist" depends="build">
    <jar destfile="dist/${ant.project.name}.jar"
      basedir="build/java" />

  </target>
</project>

   
  








Related examples in the same category

1.Value in the properties file overwrite the value in the build.xml
2.Redefine property in the children target
3.Redefine property in the children target 2
4.Load file through URL
5.Referrence property: basedir
6.Custom properties
7.Define custom property based on existing properties
8.Ant buildin properties
9.Separate two values
10.In init target set the properties
11.Define and reference property