buildr-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anders Janmyr <anders.jan...@jayway.com>
Subject Re: Download dependency
Date Wed, 17 Feb 2010 18:39:44 GMT
Hi again,
I can reproduce it with buildr-1.3.5, Here is a session with the full
buildfile after.

Anders

[512:words (master)]$ rm -r /Users/andersjanmyr/.m2/repository/google/
[513:words (master)]$ buildr
(in /Users/andersjanmyr/Projects/words, development)
Building words
Installed /Users/andersjanmyr/Projects/words/target/zip/google-collect-1.0/google-collect-1.0.jar
as google:google-collect:jar:1.0
Completed in 0.031s
[514:words (master)]$ buildr
(in /Users/andersjanmyr/Projects/words, development)
Building words
Completed in 0.016s
[515:words (master)]$ find /Users/andersjanmyr/.m2/repository/google/
/Users/andersjanmyr/.m2/repository/google/
/Users/andersjanmyr/.m2/repository/google//google-collect
/Users/andersjanmyr/.m2/repository/google//google-collect/1.0
/Users/andersjanmyr/.m2/repository/google//google-collect/1.0/google-collect-1.0.jar
/Users/andersjanmyr/.m2/repository/google//google-collect/1.0/google-collect-1.0.pom
[516:words (master)]$ buildr --version
Buildr 1.3.5
[517:words (master)]$


And here is the full buildfile

require 'buildr'
require 'rake'

repositories.remote << 'http://www.ibiblio.org/maven2'

define 'words' do
  project.version = '1.0.0'

  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

  define 'cli' do
    compile.with project('core'),
project('core').compile.dependencies,
'commons-cli:commons-cli:jar:1.2'
    package :jar

    task :run => :compile do
      classpath =
"#{path_to('target/classes')}:#{project('cli').compile.dependencies.join(':')}"
      cmd = "java -cp #{classpath} words.cli.WordsCli #{ENV['args']}"
      puts cmd
      system cmd
    end
  end
end

On Wed, Feb 17, 2010 at 4:41 PM, Alex Boisvert <alex.boisvert@gmail.com> wrote:
> On Tue, Feb 16, 2010 at 8:58 PM, Anders Janmyr <anders.janmyr@jayway.com>wrote:
>
>> Hi Alex,
>>
>> >
>> > 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:
>> >
>> It actually does install the artifact into the repository. I'll show a
>> session below.  But I will use your suggestion anyway.
>>
>
> Strange.  I can't reproduce this with Buildr 1.3.5 (Ubuntu/x86) and I don't
> see how it could happen unless your calling install() on the artifact.
> Here's the buildfile I'm using:
>
> 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)
>    # I commented this to test whether the artifact gets installed w/o
> calling install()
>    #a.install
>  end
> end
>
> define 'core' do
>  project.version = '0.1'
>  project.group = 'com.example'
>  compile.with 'commons-lang:commons-lang:jar:2.4', google_artifact
>  package :jar
> end
>
> Can you send me your actual buildfile?  (Or a stripped-down version that
> installs the artifact on your system?)
>
> alex
>



-- 
http://anders.janmyr.com/

Mime
View raw message