#!/bin/bash
set -xe
PROJECT_PREFIX=`readlink -e ..`
export M2_HOME=$PROJECT_PREFIX/kit/m2

rm lib/*jar

for i in $PROJECT_PREFIX/kit/jars/*
  do
  ln -sr $i lib
  done

mkdir build
rm -rf ~/.m2/
mkdir -p ~/.m2/

ln -sr ${PROJECT_PREFIX}/kit/m2 ~/.m2/repository
ln -sr $PROJECT_PREFIX/kit/jars/maven-ant-tasks-*jar build

export ANT_HOME=${PREFIX}/kit/apache-ant-1.9.7/lib:$PWD/lib

$PROJECT_PREFIX/kit/apache-ant-1.9.7/bin/ant clean
$PROJECT_PREFIX/kit/apache-ant-1.9.7/bin/ant
$PROJECT_PREFIX/kit/apache-ant-1.9.7/bin/ant javadoc
mv build/javadoc .
rm -rf ~/.m2
