You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@buildr.apache.org by Ilya Pyatigorskiy <at...@gmail.com> on 2010/12/03 14:37:09 UTC

downloading an external jar as an artifact

Hi

I'm extremely new to both ruby and buildr, so I'm pretty sure I'm asking a
stupid thing right now, but I wasn't able to google it.

My target is to be able to specify jar versions in a single place and I like
the build.yaml approach, but some of the libs do not exist in the maven
world, so I want buildr to download them. Taking the DOJO example from the
docs I was able to create the following config:

--- build.yaml ---
# This project requires the following ruby gems, buildr addons
artifacts:
  hamcrest: hamcrest:hamcrest:all:1.3.0RC2
--- /build.yaml ---

--- buildfile ---
hamcrestVer = Buildr.settings.build['artifacts'][:hamcrest.to_s][/[^:]+$/]
hamcrestUrl = "
http://hamcrest.googlecode.com/files/hamcrest-all-#{hamcrestVer}.jar"
download(artifact(:hamcrest)=>hamcrestUrl)

desc "The project"
define "proj" do
  define "webui" do
    compile.with :hamcrest
  end
end
--- /buildfile ---

that does work, but the way I was finally able to obtain the hamcrest
version seems quite ugly to me. What would be a better way to achieve the
same?

Thank you!

Ilya.

Re: downloading an external jar as an artifact

Posted by Victor Hugo Borja <vb...@apache.org>.
Hi,

Try  artifact(:hamcrest).version

Cheers

On Fri, Dec 3, 2010 at 7:37 AM, Ilya Pyatigorskiy <at...@gmail.com> wrote:

> Hi
>
> I'm extremely new to both ruby and buildr, so I'm pretty sure I'm asking a
> stupid thing right now, but I wasn't able to google it.
>
> My target is to be able to specify jar versions in a single place and I
> like
> the build.yaml approach, but some of the libs do not exist in the maven
> world, so I want buildr to download them. Taking the DOJO example from the
> docs I was able to create the following config:
>
> --- build.yaml ---
> # This project requires the following ruby gems, buildr addons
> artifacts:
>  hamcrest: hamcrest:hamcrest:all:1.3.0RC2
> --- /build.yaml ---
>
> --- buildfile ---
> hamcrestVer = Buildr.settings.build['artifacts'][:hamcrest.to_s][/[^:]+$/]
> hamcrestUrl = "
> http://hamcrest.googlecode.com/files/hamcrest-all-#{hamcrestVer}.jar"
> download(artifact(:hamcrest)=>hamcrestUrl)
>
> desc "The project"
> define "proj" do
>  define "webui" do
>    compile.with :hamcrest
>  end
> end
> --- /buildfile ---
>
> that does work, but the way I was finally able to obtain the hamcrest
> version seems quite ugly to me. What would be a better way to achieve the
> same?
>
> Thank you!
>
> Ilya.
>



-- 
vic

Quaerendo invenietis.