buildr-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antoine Toulme <anto...@lunar-ocean.com>
Subject Re: Executing Ant build scripts
Date Thu, 09 Sep 2010 05:51:58 GMT
Yes for antwrap.

And if you do anything with the classpath, do it before you define anything.

On Wed, Sep 8, 2010 at 22:38, Peter Donald <peter@realityforge.org> wrote:

> > 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")
> >        Java.org.apache.tools.ant.Main.main(['-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 trunk?
>
> 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
> http://antwrap.rubyforge.org/
>
>
> --
> Cheers,
>
> Peter Donald
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message