You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@buildr.apache.org by Carlos Sanchez <ca...@apache.org> on 2011/02/18 17:13:11 UTC

Using buildr artifact download from ruby

Hi,

I was wondering if buildr could be used to download artifacts from a
Maven repository from any ruby script. I need to download them using
ruby and thought about giving a try to buildr before going for jruby
or something more complicated.

Something along the lines of

require 'rubygems'
require 'buildr'

artifact('org.apache.openjpa:openjpa:jar:1.2.1').invoke


which of course doesn't work.

Any suggestions?

Thanks

Re: Using buildr artifact download from ruby

Posted by Alex Boisvert <al...@gmail.com>.
On Fri, Feb 18, 2011 at 8:13 AM, Carlos Sanchez <ca...@apache.org> wrote:

> I was wondering if buildr could be used to download artifacts from a
> Maven repository from any ruby script. I need to download them using
> ruby and thought about giving a try to buildr before going for jruby
> or something more complicated.
>
> Something along the lines of
>
> require 'rubygems'
> require 'buildr'
>
> artifact('org.apache.openjpa:openjpa:jar:1.2.1').invoke
>
> which of course doesn't work.
>
> Any suggestions?
>

If you don't mind a little hack, the following works on recent versions of
buildr:

require 'rubygems'
require 'buildr'

class << Buildr.application
  def rakefile; __FILE__; end
end

Buildr.repositories.remote << "http://www.ibiblio.org/maven2/"

artifact('org.apache.openjpa:openjpa:jar:1.2.1').invoke

I think it was possible to use buildr as a library without this little hack
at some point... and I wouldn't mind explicitly supporting this since it's
pretty convenient to do things outside the scope of a buildfile for certain
use-case.

alex