iconara/puck

Puck for library jar creation

Closed this issue · 2 comments

I'm working on a Jruby Vertx project and because of Vertx fatjar creation I have concluded that I need a way of packing up gems into a jar in such a way that those gems are in Jruby loadpath, to be clear the final jar which is driven by the shadowJar plugin is meant to pack up all java dependencies along with a jar that represents needed Jruby gems

I have struggled to find a beast that does all of that.

Your readme does not directly mention whether the resulting jar from the Puck packaging process could indeed be used as a library jar but maybe you could elaborate ?

thanks once again

If you need the gems to be in the load path I don't think you can do what you describe. I'm not clear on whether or the application will be booted by JRuby, but I assume it is. In that case I think you could reverse the process: you build your Java dependencies and use the :merge_archives feature of Puck to create a final jar with all the gems, and the Java dependencies.

The issue is that if you use shadowJar (I assume you're talking about the Maven plugin here), it won't create a jar that will boot JRuby, which in turn means that there won't be anything that sets up the load path.

If you can't do it the way I suggest, you can always look at how Puck sets up the jar and try to replicate that in your build process. It's not that much that needs to be done. Most of the complexity is in dealing with Bundler and building the jar.