ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephane Bailliez <sbaill...@imediation.com>
Subject RE: JUnit and Ant
Date Tue, 15 May 2001 16:47:30 GMT
> -----Original Message-----
> From: Otto Mok [mailto:omok@sitraka.com]
> 
> I have the same problem.
> Basically, I can get junit tasks working in my build.xml
> But I would like it to work with the following constraints:
> 1. Do not add junit.jar in the CLASSPATH.
> 2. Do not put junit.jar in the lib directory of ANT_HOME.
> 
> And I have good reason for it.
> I want to minimize the set-up requirement for the developer's 
> workstation.
> When I upgrade junit or add other modules, EVERY developer
> would need to update his/her CLASSPATH or update the jar files in the
> lib directory of ANT_HOME.
> 
> Has anyone found a way to get around this?
> Is it even possible?

Ant is under source control as well as all the third party libs.
Each module has its own build.sh/build.xml.
The build.sh calls a ant script in ANT_HOME similar to the one in
ANT_HOME/bin
, it is something like:
#! /bin/sh

ANT_HOME=../../../ant
PWD=`pwd`
ANT_HOME=`cd $ANT_HOME; pwd; cd $PWD`
sh $ANT_HOME/etc/antrun.sh "$ANT_HOME" $@

the ANT_HOME and third party are accessed in a relative way since we are
working under clearcase and the root(deepness) is not the same for a mounted
view under Unix and NT, thus the stupid trick above resolves the ANT_HOME
path name so that I can pass an absolute ANT_HOME path as a ant.home
property to ant. 

I also need an absolute path because I have some build.xml that have a
different basedir from . and I want to grab only the ant jars (ant.jar,
optional.jar) and not using the full java.class.path just to append to the
junit forked classpath. (the classpath needed to run ant is far from being
the same as the one to test my app and some are simply incompatible)

the antrun.sh does pretty what antrun does except that it gets all the jars
needed to run ant and its optional tasks.
If there is a new jar to be added. I'm simply modifying this file and all
users will run ant with the same classpath.

I probably could have done it simpler, this was a first shot to come around
multiple problems between ant and clearcase and unifying the run scripts to
shell only (cygwin on NT)

The way above since all third party libs, ant, and the run scripts are under
source control and cannot be accessed by normal developers, upgrading ant, a
third party lib or the script is simply saw by everyone since this is
centralized at a single place. (there is only 1 junit.jar, it is referenced
in the build.xml and in the antrun.sh when creating the ant classpath)

The next step is to completely abstract the reference to these libs in all
build.xml and to use something like:

<pathelement location="${junit}"/>

instead of:

<pathelement location="{thirdparty.dir}/junit.jar"/>

But not sure it will be an easy thing to use.

Hope it helps.

-- 
 St├ęphane Bailliez 
 Software Engineer, Paris - France 
 iMediation - http://www.imediation.com 
 Disclaimer: All the opinions expressed above are mine and not those from my
company. 



Mime
View raw message