While the uberjar task works 'in theory' it ended up not being usable
for the project I am working on. The classloader of Classworlds would
bomb on reflection based injection used by Spring annotations. The app
is also noticeably slower on startup using Classworlds as well. *sigh*
The package(:jar).merge sounds good, but wouldn't duplicates get
overwritten? I have config xmls that are layered in various jars under
the same name. The solution I ended up with was to use `buildr run` from
a checkout of the app. Perhaps I'll tweak the app to avoid the name
collision and try the package(:jar).merge.
I am half tempted to monkey around with Classworlds (perhaps Maven's
shale?) directly to make it do what I want. Seems being able to make
uberjars would be useful. Of coarse, I like java as stand alone services
and avoid the monolithic app servers, so I am a bit bias.
On 04/14/2011 03:13 AM, Marc-André Laverdière wrote:
I think that Alex's option is good enough for most cases, but I do see
a point in integrating this. I think that Buildr will benefit a lot
from having a richer feature set, as it would attract more people to
it.
Just my 2 paise :)
On 4/14/11, Alex Boisvert<[email protected]> wrote:
Cool, thanks for sharing!
I usually do package(:jar).merge(some_other_jar) myself ... until it gets
intolerably slow. Don't know why rubyzip is so CPU-consuming... anyway at
that point I end up forking to zip/jar and do the same externally.
alex
On Wed, Apr 13, 2011 at 2:08 PM, Michael Guymon
<[email protected]>wrote:
I spent hours fighting Classworld's uberjar to get it to work, figured I
would share the fruit of my labor. There are no examples that I could find
and the docs are outdated, so I hit it with a hammer until it worked. The
task will package the project jar and it's dependencies, allowing the
produced jar to be run by 'java -jar'. Here is the example task:
https://gist.github.com/c0804a3eb5c3793eee19
It copies the project jars, creates the classworld conf, explodes the
classwords-boot jar and wraps it up into project-ubjerjar-version.jar
--Michael