buildr-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Grotzke <martin.grot...@javakaffee.de>
Subject Re: Detect duplicate deps for :war packages
Date Tue, 25 Aug 2009 23:44:57 GMT
Great, thanx for this! I'll add this with some info to the wiki soon.

Cheers,
Martin


On Tue, 2009-08-25 at 10:43 +0200, Antoine Toulme wrote:
> That's part of the price to pay for transitive dependencies, and you should
> do your own home brewed ruby script to deal with duplicate dependencies your
> own way.
> 
> Here is a way to do it:
> libs = [project('core').compile.dependencies,
> compile.dependencies].flatten.compact.uniq
> 
> libs_by_id = {}
> libs.each do |lib|
>   lib = artifact(lib)
>   if libs_by_id[lib.id].nil?
>    libs_by_id[lib.id] = lib
>   else
>     libs_by_id[lib.id] = lib if libs_by_id[lib.id].version < lib.version
>   end
> end
> 
> libs = libs_by_id.values
> 
> Note
> that's not related to war packaging at all, that works in any packaging.
> If you want to specify version, you can do so by acting on the versions as I
> do.
> 
> 
> On Tue, Aug 25, 2009 at 09:24, Martin Grotzke
> <martin.grotzke@javakaffee.de>wrote:
> 
> > Hi,
> >
> > this is related to my other post: I want to detect duplicate artifacts
> > for a package of type war. For a "webapp" subproject it might look like
> > this:
> >
> >  package(:war).with :libs=>[project('core').compile.dependencies,
> > compile.dependencies]
> >
> > For us this leads to several duplicate libs in WEB-INF/lib that I would
> > like to filter out.
> >
> > Also a good thing would be to be able to specify which version to use
> > for a certain artifact.
> >
> > I also found the artifact_namespace.rb, which seems to allow more
> > advanced artifact handling, but I don't see if this would help in this
> > situation. Right now we specify artifacts dead simple like
> > FOO = transitive('group:id:type:version')
> > and use this in project.compile.with.
> >
> > Any hints how to improve this situation?
> >
> > Thanx && cheers,
> > Martin
> >
> >

Mime
View raw message