Find file
Fetching contributors…
Cannot retrieve contributors at this time
117 lines (100 sloc) 3.91 KB
<project xmlns:ivy="antlib:org.apache.ivy.ant" name="hello-ivy" default="run" basedir=".">
<property name="ivy.install.version" value="2.2.0" />
<condition property="ivy.home" value="${env.IVY_HOME}">
<isset property="env.IVY_HOME" />
<property name="ivy.home" value="${user.home}/.ant" />
<property name="ivy.jar.dir" value="${ivy.home}/lib" />
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar" />
<target name="download-ivy" depends="libscheck" unless="libs.uptodate">
<mkdir dir="${ivy.jar.dir}"/>
<!-- download Ivy from web site so that it can be used even without any special installation -->
<get src="${ivy.install.version}/ivy-${ivy.install.version}.jar"
dest="${ivy.jar.file}" usetimestamp="true"/>
<target name="init-ivy" depends="download-ivy">
<!-- try to load ivy here from ivy home, in case the user has not already dropped
it into ant's lib dir (note that the latter copy will always take precedence).
We will not fail as long as local lib dir exists (it may be empty) and
ivy is in at least one of ant's lib dir or the local lib dir. -->
<path id="ivy.lib.path">
<fileset dir="${ivy.jar.dir}" includes="*.jar"/>
<taskdef resource="org/apache/ivy/ant/antlib.xml"
uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
<!-- =================================
target: resolve
================================= -->
<target name="libscheck">
<uptodate property="libs.uptodate">
<srcfiles dir="." includes="ivy.xml"/>
<mapper type="merge" to="lib/.done"/>
<target name="resolve" description="--> retrieve dependencies with ivy"
depends="init-ivy,libscheck" unless="libs.uptodate">
<ivy:retrieve />
<touch file="lib/.done" />
simple example build file
<!-- 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 -->
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}"/>
<mkdir dir="${dist}"/>
<path id="project.classpath">
<pathelement path="${build}"/>
<fileset dir="lib">
<include name="**/*.jar"/>
<target name="compile" depends="init,resolve"
description="compile the source " >
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${build}" debug="yes">
<classpath refid="project.classpath" />
<target name="run" depends="compile">
<!-- description="Execute the program as-is - no compilation is performed" -->
<java classname="Jacksontest" fork="yes">
<jvmarg value="-Xmx2048m -Xms2048m" />
<path refid="project.classpath" />
<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 name="clean"
description="clean up" >
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}"/>
<delete dir="${dist}"/>
<target name="hadoop" depends="compile">
<mkdir dir="${build}/lib"/>
<unjar src="lib/jedis-1.5.2.jar" dest="${build}" />
<jar jarfile="${dist}/pig-redis.jar"
<attribute name="Main-Class"