Java/Ant/Target
Версия от 18:01, 31 мая 2010; (обсуждение)
Ant target depends on other targets
<project name="YourName" default="all">
<target name="all" depends="init,clean,compile,createJars,copyBuild" >
</target>
<target name="init" description="Project">
<property environment="env" />
<property name="j2sdkApi" value="${env.JAVA_HOME}/jre/lib/rt.jar" />
<property name="src" value="./src" />
<property name="build" value= "./build" />
</target>
<target name="clean" description="build" depends="init">
<delete dir="${build}" />
<mkdir dir="${build}" />
</target>
<target name="compile" description="compile" depends="init">
<javac srcdir="${src}" destdir="${build}" >
<classpath path="${j2sdkApi}" />
<include name="**/application/**"/>
<include name="**/types/**"/>
</javac>
</target>
<target name="copyBuild" description="desccription here">
<copy file="${src}/LOGOUNB_CAPA.JPG" todir="${build}/" />
<copydir src="${src}/config" dest="${build}/config" />
</target>
<target name="createJars" description="jars" depends="compile">
<mkdir dir="${build}/xml/jar"/>
<jar jarfile="${build}/br/xml/jar/xpfg.jar"
basedir="${build}/unb/cic/xml" />
<manifest file="manifest.mf">
<attribute name="Main-Class" value="${build}/br/unb/cic/xml/XMLMain" />
</manifest>
</target>
</project>
Default target
<?xml version="1.0"?>
<project name="Apache Ant Properties Project" default="properties.built-in" basedir=".">
<target name="properties.built-in">
<echo message="The base directory: ${basedir}"/>
<echo message="This file: ${ant.file}"/>
<echo message="Ant version: ${ant.version}"/>
<echo message="Project name: ${ant.project.name}"/>
<echo message="Java version: ${ant.java.version}"/>
</target>
</project>