Hi,

It looks like you are using a local/file dependency which I did not account
for. So what you need to do is add the prefix like
"!a.respond_to?(:to_spec) || " in your select block. I have updated the
example [1] to demonstrate this.

HTH

[1]
https://github.com/realityforge/buildr-examples/commit/2649848058d9213e8be928148686685d57ffb566

On Fri, Oct 31, 2014 at 7:43 PM, Jean-Philippe Caruana <j...@target2sell.com>
wrote:

> Hi Peter,
>
> thank you for your answer.
> I tried the solution you gave, but it doesn't compile :
>
> $ buildr --version
> Buildr 1.4.20
>
> $ buildr package
> (in /home/jp/src/t2s/performance-tests/querySimulator, development)
> sh: 2: Syntax error: EOF in backquote substitution
> Buildr aborted!
> NoMethodError : undefined method `to_spec' for #<String:0x0000000397c6a8>
> /home/jp/src/t2s/performance-tests/querySimulator/buildfile:46:in `block
> (3 levels) in <top (required)>'
> /home/jp/src/t2s/performance-tests/querySimulator/buildfile:46:in `block
> (2 levels) in <top (required)>'
> /home/jp/src/t2s/performance-tests/querySimulator/buildfile:45:in `tap'
> /home/jp/src/t2s/performance-tests/querySimulator/buildfile:45:in `block
> in <top (required)>'
>
> /var/lib/gems/1.9.1/gems/buildr-1.4.20/lib/buildr/core/application.rb:426:in
> `raw_load_buildfile'
>
> /var/lib/gems/1.9.1/gems/buildr-1.4.20/lib/buildr/core/application.rb:225:in
> `block in load_buildfile'
>
> /var/lib/gems/1.9.1/gems/buildr-1.4.20/lib/buildr/core/application.rb:220:in
> `load_buildfile'
> (See full trace by running task with --trace)
>
>
> my buildfile looks like this :
>
>   package(:jar)
>   package(:tgz).tap do |pkg|
>     pkg.path('lib').include package(:jar), compile.dependencies.select
> {|a| a.to_spec != 'org.scala-lang:scala-compiler:jar:2.10.4'}
>     pkg.path('etc').include _('src/main/resources')
>     pkg.path('bin').include _('src/main/bin')
>   end
>
>
> I also tried it like this :
>
>   generated_lib = package(:jar).exclude '*.properties*'
>   livrable = package :tgz
>   livrable.path('lib').include generated_lib,
> compile.dependencies.select { |a| a.to_spec !=
> 'org.scala-lang:scala-compiler:jar:2.10.4' }
>   livrable.path('lib').exclude 'scala-compiler-2.10.4.jar'
>
>   livrable.include _('src/main/resources'), :as => 'etc'
>   livrable.include _('src/main/bin'), :as => 'bin'
>
> But got a similar error:
> Buildr aborted!
> NoMethodError : undefined method `to_spec' for #<String:0x0000000308d600>
> /home/jp/src/t2s/performance-tests/querySimulator/buildfile:45:in `block
> (2 levels) in <top (required)>'
> /home/jp/src/t2s/performance-tests/querySimulator/buildfile:45:in `block
> in <top (required)>'
>
> /var/lib/gems/1.9.1/gems/buildr-1.4.20/lib/buildr/core/application.rb:426:in
> `raw_load_buildfile'
>
> /var/lib/gems/1.9.1/gems/buildr-1.4.20/lib/buildr/core/application.rb:225:in
> `block in load_buildfile'
>
> /var/lib/gems/1.9.1/gems/buildr-1.4.20/lib/buildr/core/application.rb:220:in
> `load_buildfile'
>
>
> Thanks
>
> Le 30/10/2014 23:24, Peter Donald a écrit :
> > Hi,
> >
> > The easiest way to do this is probably replace
> >
> > compile.dependencies
> >
> > with
> >
> > compile.dependencies.select {|a| a.to_spec != 'org.scala-lang:scala-
> > compiler:jar:2.10.4'}
> >
> > I put together an example of this at
> >
> >
> https://github.com/realityforge/buildr-examples/tree/master/include_select_deps
> >
> > HTH
> >
> >
> > On Fri, Oct 31, 2014 at 1:16 AM, Jean-Philippe Caruana <
> j...@target2sell.com>
> > wrote:
> >
> >> Hi,
> >>
> >> I want to package a scala project as a tgz. In the generated tgz, the
> >> scala-compiler-2.10.4.jar is included : it is heavy (14M) and
> unnecessary.
> >>
> >> I try to remove it, but it doesn't work :
> >>
> >>   generated_lib = package(:jar).exclude '*.properties*'
> >>   livrable = package :tgz
> >>   livrable.path('lib').include generated_lib, compile.dependencies
> >>   livrable.path('lib').exclude 'scala-compiler-2.10.4.jar'
> >>
> >>
> >> I added a (always failing) check:
> >>
> >>   check livrable, "doesn't need the very heavy (14M) scala-compiler.jar
> "
> >> do
> >>     it.should_not contain('lib/scala-compiler-2.10.4.jar')
> >>   end
> >>
> >>
> >> I also tried
> >>   generated_lib = package(:jar).exclude '*.properties*'
> >>   livrable = package :tgz
> >>   livrable.path('lib').include generated_lib, (compile.dependencies -
> >> 'org.scala-lang:scala-compiler:jar:2.10.4')
> >>
> >> How can I do ?
> >>
> >> --
> >> Jean-Philippe Caruana
> >> http://www.barreverte.fr
>
> --
> Jean-Philippe Caruana
> http://www.barreverte.fr
>
>


-- 
Cheers,

Peter Donald

Reply via email to