You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@buildr.apache.org by bogdan teleman <te...@gmail.com> on 2010/09/13 16:25:42 UTC
create a jar that include libs and other project
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.
Re: create a jar that include libs and other project
Posted by bogdan teleman <te...@gmail.com>.
I made some research and I found that some libs when I unpack them give some
errors (from krusader for example I can't unpack them at all, and from gnome
I have some files with errors), so the code from Kristof Jozsa si good, and
I think that my code is good as well.
Thanks for helping me.
Re: create a jar that include libs and other project
Posted by Antoine Toulme <an...@lunar-ocean.com>.
Please copy the full stacktrace so we can see where the error comes from.
On Tue, Sep 14, 2010 at 03:40, bogdan teleman <te...@gmail.com> wrote:
> this gives me the same error: "TypeError : can't dup NilClass", I assume
> (as
> i said in first mail), this error is because my project depends on other
> project (that is not a lib).
>
Re: create a jar that include libs and other project
Posted by bogdan teleman <te...@gmail.com>.
this gives me the same error: "TypeError : can't dup NilClass", I assume (as
i said in first mail), this error is because my project depends on other
project (that is not a lib).
Re: create a jar that include libs and other project
Posted by Kristof Jozsa <kr...@gmail.com>.
Examining my buildfile I also had this:
#pack = package(:jar) \
# .with(:manifest =>
manifest.merge('Main-Class'=>'com.gts.updatestatus.Broker')) \
# .merge(compile.dependencies)
I believe this was working while it was uncommented..
K
On Tue, Sep 14, 2010 at 9:49 AM, bogdan teleman <te...@gmail.com> wrote:
> Thanks,
>
> it copy all dependencies in target/dependencies, but don't merge them in
> the
> jar file. What should I change to merge all libs from target/dependencies
> in
> my jar file?
>
Re: create a jar that include libs and other project
Posted by bogdan teleman <te...@gmail.com>.
Thanks,
it copy all dependencies in target/dependencies, but don't merge them in the
jar file. What should I change to merge all libs from target/dependencies in
my jar file?
Re: create a jar that include libs and other project
Posted by Kristof Jozsa <kr...@gmail.com>.
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 <te...@gmail.com> 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.
>