ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stephan beal <>
Subject Re: article: combining make and ant
Date Thu, 21 Mar 2002 14:19:00 GMT
On Thursday 21 March 2002 15:02 pm, you wrote:
> > No, i'm saying it's more work to do in ant. Also, we MUST (in my case)
> > run ant multiple times, because of the dependency on not-yet-built custom
> > tasks. Ant *cannot* load our build.xml unless these tasks exist and are
> > in the classpath before ant starts. Without some sort of front-end (make,
> > batch file, whatever), the developer has to run ant twice. Make fills
> > this gap for us.
> Are you sure ? I have had no probelm of detecting tasks are not built,
> rebuilding them, taskdefing them and then continuing with the build - all
> inside the ant file?
> What in particular makes you think you need to restart ant?

It may have to do with the order of my <taskdefs> in build.xml, then? 
Certainly conceivable. Here's what i see if i run ant without our custom 
tasks in the classpath (i.e., they aren't built yet):

build@poe:~/cvs/int > ant -buildfile build.stephan.xml
Buildfile: build.stephan.xml


/home/build/cvs/int/build.stephan.xml:16: taskdef class 
de.einsurance.ant.CVSUpdateTask cannot be found

Fair enough - this is what i would expect. The solution, then, would be to 
build it from a separate process (one which doesn't use <taskdef>s to those 

Now if i build the tasks, then re-run ant, it works. Using this make snippet 
takes care of that for me:
ant_home = ${PWD}/ant
ant = ${ant_home}/bin/ant
ant_libdir = ${ant_home}/lib
ant_extensions = ${ant_libdir}/einsurance_ant.jar
ant_classpath = ${ant_extensions}
ant_args := ${ant_args} -buildfile build.stephan.xml -emacs
${ant_extensions}: Makefile ${ant_home}/build.antextensions.xml
	cd ${ant_home} && ${MAKE}
ant-%: ${ant_extensions}
	@target=$@; target=$${target#*-}; \
	ANT_HOME=${ant_home}; \
	PATH=${ant_home}/bin:$$PATH; \
	CLASSPATH=${ant_classpath}:$$CLASSPATH; \
	${ant} $$target ${ant_args}

Now when a run an ant task via make, make first builds the tasks (if needed) 
and sticks them into my classpath. (This is mostly just to save me some 
typing - there is no "requirement" that it work this way.) The build.xml 
which builds the tasks does not have a <taskdef> for any of the custom tasks, 
so ant has no problem reading that build.xml. Again, it may be that if i move my 
<taskdef>s to the end of my build.xml, that it may work. i haven't tried that.

> And theres also bucketloads of things that make does far better than ant -
> Ants still relatively young but we are getting there ;)

No complaints from me, certainly :). i've been having a great time playing 
with it the past week. i won't start using it for my C++ work (can't build 
shared libs in a cross-platform way using ant ;), but i certainly won't use 
make (alone) for any more of my Java work.

----- stephan
Generic Universal Computer Guy -
Office: +49 (89)  552 92 862 Handy:  +49 (179) 211 97 67
"I ain't gen'rally given to physicality of that nature but it saves
a lot of arguing." -- Nanny Ogg

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message