Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
HADOOP-3305. Use Ivy to manage dependencies. Contributed by Giridhara…
…n Kesavan and Steve Loughran.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/trunk/src/contrib/chukwa@726872 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
cutting committed Dec 15, 2008
1 parent 9d813ea commit 7e702d92b8d67312ae1fa3a6661bb4595d2d529e
Show file tree
Hide file tree
Showing 20 changed files with 291 additions and 1,949 deletions.
113 build.xml
@@ -17,7 +17,8 @@
limitations under the License.
-->

<project name="chukwa" default="main">
<project name="chukwa" default="main"
xmlns:ivy="antlib:org.apache.ivy.ant">

<property name="name" value="chukwa"/>
<property name="chukwaVersion" value="0.1.1"/>
@@ -36,7 +37,7 @@
<and><available file="../build-contrib.xml" property="present"/></and>
</condition>

<target name="init-standalone" if="standaloneMode">
<target name="init-standalone" depends="ivy-retrieve" if="standaloneMode">
<echo>Standalone Mode</echo>
<property environment="env"/>
<property name="basedir" value="."/>
@@ -67,6 +68,7 @@
<fileset dir="${hadoop.home.jars.dir}"> <!-- ASR -->
<include name="**/*core*.jar" />
</fileset>
<path refid="contrib-classpath"/>
</path>
<path id="testClasspath">
<pathelement location="${build.classes}"/>
@@ -82,6 +84,7 @@
<fileset dir="${hadoop.home.jars.dir}"> <!-- ASR -->
<include name="**/*core*.jar" />
</fileset>
<path refid="contrib-classpath"/>
</path>
<path id="testDemuxClasspath">
<pathelement location="${build.classes}"/>
@@ -94,11 +97,80 @@
<include name="**/*.jar" />
<exclude name="**/excluded/" />
</fileset>

<path refid="contrib-classpath"/>
</path>
</target>

<target name="ivy-init-properties-local" description="to initiate ivy properties">
<property name="ivy.dir" location="ivy" />
<property name="ivysettings.xml" location="${ivy.dir}/ivysettings.xml"/>
<loadproperties srcfile="${ivy.dir}/libraries.properties"/>
<loadproperties srcfile="${ivy.dir}/libraries.properties"/>
<property name="ivy.jar" location="${ivy.dir}/ivy-${ivy.version}.jar"/>
<property name="ivy_repo_url"
value="http://repo2.maven.org/maven2/org/apache/ivy/ivy/${ivy.version}/ivy-${ivy.version}.jar" />
<property name="build.dir" location="build" />
<property name="build.ivy.dir" location="${build.dir}/ivy" />
<property name="build.ivy.lib.dir" location="${build.ivy.dir}/lib" />
<property name="build.ivy.report.dir" location="${build.ivy.dir}/report" />
<property name="common.ivy.lib.dir" location="${build.ivy.lib.dir}/${ant.project.name}/common"/>

<!--this is the naming policy for artifacts we want pulled down-->
<property name="ivy.artifact.retrieve.pattern"
value="${ant.project.name}/[conf]/[artifact]-[revision].[ext]"/>
</target>

<target name="ivy-download-local" description="To download ivy"
unless="offline">
<get src="${ivy_repo_url}" dest="${ivy.jar}" usetimestamp="true"/>
</target>

<target name="ivy-init-dirs-local" depends="ivy-init-properties-local">
<mkdir dir="${build.ivy.dir}" />
<mkdir dir="${build.ivy.lib.dir}" />
<mkdir dir="${build.ivy.report.dir}" />
</target>

<target name="ivy-probe-antlib-local" >
<condition property="ivy.found.local">
<typefound uri="antlib:org.apache.ivy.ant" name="cleancache"/>
</condition>
</target>

<target name="ivy-init-antlib-local" depends="ivy-init-dirs-local,ivy-download-local,ivy-probe-antlib-local" unless="ivy.found.local">
<typedef uri="antlib:org.apache.ivy.ant" onerror="fail" loaderRef="ivyLoader">
<classpath>
<pathelement location="${ivy.jar}"/>
</classpath>
</typedef>
<fail>
<condition>
<not>
<typefound uri="antlib:org.apache.ivy.ant" name="cleancache"/>
</not>
</condition>
You need Apache Ivy 2.0 or later from http://ant.apache.org/
It could not be loaded from ${ivy_repo_url}
</fail>
</target>

<target name="ivy-init-local" depends="ivy-init-antlib-local">
<ivy:configure settingsid="${ant.project.name}.ivy.settings" file="${ivysettings.xml}" override="true"/>
</target>

<target name="ivy-resolve" depends="ivy-init-local">
<ivy:resolve settingsRef="${ant.project.name}.ivy.settings" conf="common"/>
</target>

<target name="ivy-retrieve" depends="ivy-resolve"
description="Retrieve Ivy-managed artifacts for the compile/test configurations">
<ivy:retrieve settingsRef="${ant.project.name}.ivy.settings"
pattern="${build.ivy.lib.dir}/${ivy.artifact.retrieve.pattern}" sync="true" />
<ivy:cachepath pathid="contrib-classpath" conf="common" />
</target>

<target name="init-hadoop" if="hadoopMode">
<antcall target="ivy-retrieve-common"/>
<echo>Hadoop Mode</echo>
<property name="build.dir" value="${basedir}/build"/>
<property name="build.classes" value="${basedir}/build/classes"/>
@@ -116,10 +188,12 @@
<exclude name="**/excluded/" />
</fileset>
<pathelement location="${hadoop.root}/build/classes"/>
<path refid="contrib-classpath"/>
</path>
<path id="testClasspath">
<pathelement location="${build.classes}"/>
<pathelement location="${test.build.classes}"/>
<path refid="contrib-classpath"/>
<fileset dir="${lib.dir}">
<include name="**/*.jar" />
<exclude name="**/excluded/" />
@@ -135,6 +209,7 @@
<path id="testDemuxClasspath">
<pathelement location="${build.classes}"/>
<pathelement location="${test.build.classes}"/>
<path refid="contrib-classpath"/>
<fileset dir="${hadoop.root}/lib">
<include name="**/*.jar" />
<exclude name="**/excluded/" />
@@ -146,7 +221,6 @@
<pathelement location="${hadoop.root}/build/classes"/>
<pathelement location="${hadoop.root}/build/test/classes"/>
</path>


</target>

@@ -173,7 +247,8 @@
<property name="test.include" value="Test*"/>
<property name="test.classpath.id" value="test.classpath"/>
<property name="test.output" value="yes"/>
<property name="test.timeout" value="900000"/>
<!--<property name="test.timeout" value="900000"/> -->
<property name="test.timeout" value="5000"/>
<property name="test.junit.output.format" value="plain"/>
<property name="test.junit.fork.mode" value="perTest" />
<property name="test.junit.printsummary" value="yes" />
@@ -220,13 +295,13 @@
</javac>
</target>


<!--printsummary="${test.junit.printsummary}" -->

<target name="test-chukwa" depends="compile,compile-test" description="Run Chukwa unit tests">
<mkdir dir="${basedir}/var"/>
<junit showoutput="yes"
fork="yes"
printsummary="${test.junit.printsummary}"
printsummary="withOutAndErr"
forkmode="${test.junit.fork.mode}"
maxmemory="${test.junit.maxmemory}"
dir="${test.build.dir}/classes/" timeout="${test.timeout}"
@@ -291,7 +366,7 @@

<copy todir="${build.dir}/collector/WEB-INF/lib">
<fileset dir="${basedir}/lib">
<include name="log4j-1.2.13.jar" />
<include name="log4j-${log4j.version}.jar" />
<include name="${build.dir}/${final.name}-core.jar" />
</fileset>
</copy>
@@ -485,6 +560,8 @@
<!-- ================================================================== -->
<target name="clean" depends="init" description="Clean. Delete the build files, and their directories">
<delete dir="${build.dir}"/>
<delete dir="${build.ivy.lib.dir}/${ant.project.home}"/>
<delete dir="build"/>
<delete dir="${docs.src}/build"/>
</target>
<!-- ====================================================== -->
@@ -513,16 +590,21 @@
<fileset dir="${hadoop.root}/build">
<include name="hadoop-*-core.jar" />
</fileset>
<fileset dir="${hadoop.root}/lib">
<include name="commons-cli-*.jar" />
<include name="commons-codec-*.jar" />
<include name="commons-el.jar" />
<fileset dir="${build.ivy.lib.dir}\Hadoop\common">

<include name="jetty-*.jar" />
<include name="commons-httpclient-*.jar" />
<include name="commons-logging-*.jar" />
<include name="commons-net-*.jar" />
<include name="jasper-*.jar" />
<include name="jetty-*.jar" />
<include name="jsp-api.jar" />
<include name="commons-el.jar" />
<include name="commons-codec-*.jar" />
</fileset>
<fileset dir="lib">
<include name="jsp-api.jar"/>
</fileset>
<fileset dir="${hadoop.root}/lib">
<include name="commons-cli-*.jar"/>
</fileset>
</copy>
</target>
@@ -556,6 +638,9 @@
<fileset dir="lib">
<exclude name="**/native/**"/>
</fileset>
<fileset dir="${common.ivy.lib.dir}">
<include name="*.jar"/>
</fileset>
</copy>

<exec dir="${dist.dir}" executable="sh" failonerror="true">
97 ivy.xml
@@ -0,0 +1,97 @@
<?xml version="1.0" ?>
<ivy-module version="1.0">
<info organisation="org.apache.hadoop" module="${ant.project.name}">
<license name="Apache 2.0"/>
<ivyauthor name="Apache Hadoop Team" url="http://hadoop.apache.org"/>
<description>
Apache Hadoop Chukwa
</description>
</info>
<configurations defaultconfmapping="default">
<!--these match the Maven configurations-->
<conf name="default" extends="master,runtime"/>
<conf name="master" description="contains the artifact but no dependencies"/>
<conf name="runtime" description="runtime but not the artifact" />
<!--Private configurations. -->

<conf name="common" visibility="private"
extends="jetty"
description="artifacts needed to compile/test the application"/>
<conf name="jetty" visibility="private" />

</configurations>

<publications>
<!--get the artifact from our module name-->
<artifact conf="master"/>
</publications>
<dependencies>
<dependency org="commons-fileupload"
name="commons-fileupload"
rev="${commons-fileupload.version}"
conf="common->default"/>
<dependency org="commons-httpclient"
name="commons-httpclient"
rev="${commons-httpclient.version}"
conf="common->master"/>
<dependency org="commons-io"
name="commons-io"
rev="${commons-io.version}"
conf="common->default"/>
<dependency org="commons-logging"
name="commons-logging"
rev="${commons-logging.version}"
conf="common->default"/>
<dependency org="commons-codec"
name="commons-codec"
rev="${commons-codec.version}"
conf="common->master"/>
<dependency org="commons-logging"
name="commons-logging-api"
rev="${commons-logging-api.version}"
conf="common->master"/>
<dependency org="commons-net"
name="commons-net"
rev="${commons-net.version}"
conf="common->master"/>
<dependency org="tomcat"
name="servlet-api"
rev="${servlet-api.version}"
conf="common->default"/>
<dependency org="org.mortbay.jetty"
name="jetty"
rev="${jetty.version}"
conf="common->default"/>
<!-- Not able to figureout the version - resolving loaclly -->
<!--
<dependency org="org.json"
name="json"
rev="${json.version}"
conf="common->default"/>
<dependency org="org.apache.tomcat"
name="jsp-api"
rev="${jsp-api.version}"
conf="common->default"/>
<dependency org="taglibs"
name="application"
rev="${taglibs.version}"
conf="common->default"/> -->
<dependency org="org.mortbay.jetty"
name="jetty-util"
rev="${jetty-util.version}"
conf="common->default"/>
<dependency org="junit"
name="junit"
rev="${junit.version}"
conf="common->default"/>
<dependency org="tomcat"
name="servlet"
rev="${servlet.version}"
conf="common->default"/>
<dependency org="log4j"
name="log4j"
rev="${log4j.version}"
conf="common->master"/>
</dependencies>

</ivy-module>
@@ -0,0 +1,63 @@
<ivysettings>
<!--
see http://www.jayasoft.org/ivy/doc/configuration
-->
<!-- you can override this property to use mirrors
http://repo1.maven.org/maven2/
http://mirrors.dotsrc.org/maven2
http://ftp.ggi-project.org/pub/packages/maven2
http://mirrors.sunsite.dk/maven2
http://public.planetmirror.com/pub/maven2
http://ibiblio.lsu.edu/main/pub/packages/maven2
http://www.ibiblio.net/pub/packages/maven2
-->
<property name="repo.maven.org"
value="http://repo1.maven.org/maven2/"
override="false"/>
<property name="snapshot.apache.org"
value="http://people.apache.org/repo/m2-snapshot-repository/"
override="false"/>
<property name="maven2.pattern"
value="[organisation]/[module]/[revision]/[module]-[revision]"/>
<property name="maven2.pattern.ext"
value="${maven2.pattern}.[ext]"/>
<!-- pull in the local repository -->
<include url="${ivy.default.conf.dir}/ivyconf-local.xml"/>
<settings defaultResolver="default"/>
<resolvers>
<ibiblio name="maven2"
root="${repo.maven.org}"
pattern="${maven2.pattern.ext}"
m2compatible="true"
/>
<ibiblio name="apache-snapshot"
root="${snapshot.apache.org}"
pattern="${maven2.pattern.ext}"
m2compatible="true"
/>
<chain name="default" dual="true">
<resolver ref="local"/>
<resolver ref="maven2"/>
</chain>
<chain name="internal">
<resolver ref="local"/>
</chain>
<chain name="external">
<resolver ref="maven2"/>
</chain>
<chain name="external-and-snapshots">
<resolver ref="maven2"/>
<resolver ref="apache-snapshot"/>
</chain>
</resolvers>
<modules>
<!--
This forces a requirement for other hadoop-artifacts to be built locally
rather than look for them online.
-->
<module organisation="org.apache.hadoop" name=".*" resolver="internal"/>
<!--until commons cli is external, we need to pull it in from the snapshot repository -if present -->
<module organisation="org.apache.commons" name=".*" resolver="external-and-snapshots"/>
</modules>
</ivysettings>

0 comments on commit 7e702d9

Please sign in to comment.