buildr-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Boisvert <boisv...@intalio.com>
Subject Re: Using autojar to include dependencies in generated package (for an applet)
Date Tue, 18 Aug 2009 19:51:38 GMT
I think it looks pretty good as a first and one-off customization.

One thing I would consider is to reuse the same JVM and call the autojar
main() method directly instead of spawning a separate Java process for
slightly faster builds.  See
http://buildr.apache.org/more_stuff.html#javaif you want to learn
more.

alex

On Sun, Aug 16, 2009 at 1:47 PM, Levin Alexander <mail@levinalex.net> wrote:

> Hi,
>
> I'm looking to build stripped down jar files with only the minimally
> needed dependencies included. I'm using autojar to do that.
>
> However I know next to nothing about buildr (or java packaging in
> general) and would appreciate some review/critique of what I'm doing:
>
>    def add_dependencies(pkg)
>      tempfile = pkg.to_s.sub(/.jar$/, "-without-dependencies.jar")
>      mv pkg.to_s, tempfile
>
>      dependencies = compile.dependencies.map { |d| "-c #{d}"}.join(" ")
>      sh "java -jar tools/autojar.jar -baev -o #{pkg} #{dependencies}
> #{tempfile}"
>    end
>
>    # and in the project definition:
>
>    package(:jar)
>    package(:jar).enhance { |pkg| pkg.enhance { |pkg| add_dependencies(pkg)
> }}
>
> (also posted on stackoverflow.com here:
>
> http://stackoverflow.com/questions/1279419/buildr-package-dependencies-into-a-single-jar/1285293#1285293
> )
>
> Is there a better way to do this?
>
> Thank You,
> Levin
>

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