buildr-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Boisvert <alex.boisv...@gmail.com>
Subject Re: Download dependency
Date Tue, 16 Feb 2010 18:25:37 GMT
On Tue, Feb 16, 2010 at 9:45 AM, Anders Janmyr <anders.janmyr@jayway.com>wrote:

> I have an artifact that is constructed from a zip-file, like this
>
>  google_zip = download "target/google-collect-1.0.zip" =>
> 'http://google-collections.googlecode.com/files/google-collect-1.0.zip'
>  google_jar = file("target/zip/google-collect-1.0/google-collect-1.0.jar"
> => unzip('target/zip'=>google_zip))
>  google_artifact =
> artifact('google:google-collect:jar:1.0').from(google_jar)
>
>  define 'core' do
>    compile.with 'commons-lang:commons-lang:jar:2.4', google_artifact
>    package :jar
>  end
>
> If I build once and then clean and build againm the zip-file is
> downloaded again, even though
> the artifact is already in the repository. This seems wrong to me. Am
> I doing something wrong?
>

artifact(...).from(...) only changes the source of the artifact for a given
execution.   It doesn't actually install the artifact in the local Maven2
repo.   If you want to install it, you can do something along the lines of:

google_artifact = artifact('google:google-collect:jar:1.0').tap do |a|
  unless a.exist?
    google_zip = download "target/google-collect-1.0.zip" => '
http://google-collections.googlecode.com/files/google-collect-1.0.zip'
    google_jar = file("target/zip/google-collect-1.0/google-collect-1.0.jar"
=> unzip('target/zip'=>google_zip))
    google_jar.invoke
    a.from(google_jar)
    a.install
  end
end



> And by the way, I'm giving a presentation on Buildr in Stockholm,
> Sweden next week since I think Buildr is so good :)
>
> http://jwsbuildr10.eventbrite.com/ (In Swedish)
>

That's awesome!  Thanks for spreading the word.

alex

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