buildr-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Levin Alexander <>
Subject Using autojar to include dependencies in generated package (for an applet)
Date Sun, 16 Aug 2009 20:47:35 GMT

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 = { |d| "-c #{d}"}.join(" ")
      sh "java -jar tools/autojar.jar -baev -o #{pkg} #{dependencies}

    # and in the project definition:

    package(:jar).enhance { |pkg| pkg.enhance { |pkg| add_dependencies(pkg) }}

(also posted on here:

Is there a better way to do this?

Thank You,

View raw message