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