buildr-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Donald <>
Subject Re: Executing Ant build scripts
Date Thu, 09 Sep 2010 05:38:57 GMT
> Given this buildfile fragment
>    desc "TestApp"
>    define "TestApp" do
>      task :buildme do
>        Java.classpath << artifact("org.apache.ant:ant-nodeps:jar:1.8.0")
>        Java.classpath << artifact("org.apache.ant:ant-junit:jar:1.8.0")
>['-f', _("build.xml"), 'default'])
>      end
>      compile :buildme
>    end
> Any idea why the build succeeds in the TestApp directory, but not two levels up in the

You have hit one one of the most annoying things about buildr.
Java.classpath will add to the classpath if Java.init has not be
called and Java.init is called the first time someone wants to
instantiate a java class. So whether a Java.classpath succeeds in
adding a file to classpath is completely dependent on the extension
you installed, the files you require and the nesting level of projects
etc. It also seems to randomly change between releases.

The take away from this is that you should never use it if you want a
reproducible build. I experimented with using the Java module to
instantiate a URLClassLoader and adding to that but in the end I ended
up deciding that it was easier to just use command line apps.

However if what you want to do is interact with ant I would recommend
using the antwrap feature of buildr. You can see examples of it in the
addon directory or look at some documentation at


Peter Donald

View raw message