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 Sat, 20 Feb 2010 17:55:26 GMT
So, as it turns out, artifact(...).from(...) does install the artifact --
not immediately but when the artifact is invoked through the dependency
chain.   Unfortunately, I don't know what was going on before because I
can't reproduce my previous results.

I'll just call this one mystery solved since it does what it's supposed to
do and you've got a working solution to your need.

cheers,
alex


On Thu, Feb 18, 2010 at 12:01 AM, Anders Janmyr <anders.janmyr@jayway.com>wrote:

> Hi again,
>
> A version that is working, built on your suggestions. First the
> buildfile and then the session.
>
> Thanks for your help.
>
> Anders
>
> ---- Environment
> $ ruby --version
> ruby 1.8.7 (2008-08-11 patchlevel 72) [universal-darwin10.0]
> $ buildr --version
> Buildr 1.3.5
> $ uname -a
> Darwin andersjanmyrsmac.local 10.2.0 Darwin Kernel Version 10.2.0: Tue
> Nov  3 10:37:10 PST 2009; root:xnu-1486.2.11~1/RELEASE_I386 i386
>
>
> ----
> require 'buildr'
> require 'rake'
>
> repositories.remote << 'http://www.ibiblio.org/maven2'
>
> define 'words' do
>  project.version = '1.0.0'
>
>   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))
>       a.from(google_jar)
>     end
>  end
>
>  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
>
>
> -----
> $ rm -r /Users/andersjanmyr/.m2/repository/google/
>
> $ buildr clean
> (in /Users/andersjanmyr/Projects/words, development)
> Cleaning words
> Completed in 0.008s
>
> ]$ buildr test=no
> (in /Users/andersjanmyr/Projects/words, development)
> Building words
> Downloading
> http://google-collections.googlecode.com/files/google-collect-1.0.zip
> google-collect-1..: 100% |................................|
> 1.5MB/1.5MB Time: 00:00:01
> Installed
> /Users/andersjanmyr/Projects/words/target/zip/google-collect-1.0/google-collect-1.0.jar
> as google:google-collect:jar:1.0
> Compiling words:core into
> /Users/andersjanmyr/Projects/words/core/target/classes
> Compiling words:core:test into
> /Users/andersjanmyr/Projects/words/core/target/test/classes
> Skipping tests for words:core
> Packaging words-core-1.0.0.jar
> Compiling words:cli into
> /Users/andersjanmyr/Projects/words/cli/target/classes
> Note:
> /Users/andersjanmyr/Projects/words/cli/src/main/java/words/cli/WordsCli.java
> uses unchecked or unsafe operations.
> Note: Recompile with -Xlint:unchecked for details.
> Skipping tests for words
> Compiling words:cli:test into
> /Users/andersjanmyr/Projects/words/cli/target/test/classes
> Skipping tests for words:cli
> Completed in 4.251s
>
> $ 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
>
> $ buildr clean
> (in /Users/andersjanmyr/Projects/words, development)
> Cleaning words
> Completed in 0.034s
>
> $ buildr test=no
> (in /Users/andersjanmyr/Projects/words, development)
> Building words
> Compiling words:core into
> /Users/andersjanmyr/Projects/words/core/target/classes
> Compiling words:core:test into
> /Users/andersjanmyr/Projects/words/core/target/test/classes
> Skipping tests for words:core
> Packaging words-core-1.0.0.jar
> Compiling words:cli into
> /Users/andersjanmyr/Projects/words/cli/target/classes
> Note:
> /Users/andersjanmyr/Projects/words/cli/src/main/java/words/cli/WordsCli.java
> uses unchecked or unsafe operations.
> Note: Recompile with -Xlint:unchecked for details.
> Skipping tests for words
> Compiling words:cli:test into
> /Users/andersjanmyr/Projects/words/cli/target/test/classes
> Skipping tests for words:cli
> Completed in 1.302s
>
>
>
> On Wed, Feb 17, 2010 at 7:39 PM, Anders Janmyr <anders.janmyr@jayway.com>
> wrote:
> > 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/
> >
>
>
>
> --
> http://anders.janmyr.com/
>

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