I did this:
# util method to copy dependencies
def copy_deps(pkg)
deps_dir = self._('target/dependencies')
mkdir_p deps_dir
compile.dependencies.each { |dep| cp dep.to_s, deps_dir }
end
and using it like this:
pack = package :jar, :id => 'cdm'
pack.enhance { |pkg| copy_deps(pkg) }
hope that helps..
K
On Mon, Sep 13, 2010 at 2:25 PM, bogdan teleman <[email protected]> wrote:
> Hy,
>
> I have 2 Java projects (eg p1 and p2) and I want to create jar (using
> buildr) that contains both projects and their libs.
>
> p2 depends on p1.
>
> compile.with(projects('p1'),
> removeDups(project('p1').compile.dependencies), removeDups(P2_LIBS))
>
> package(:jar).with( :manifest => {'Main-Class' => 'com.p2.Main'} )
>
> compile.dependencies.each do |x|
> if x
> package(:jar).merge(x).exclude('META-INF/MANIFEST.MF')
> end
> end
>
> I tried this, but that give me an error, I think because p2 depends on p1,
> because if I have only p2 and libs this works.
>
> So how should I create the jar file with p1, p2 an libs?
>
>
> Thanks.
>