Background
----------

* I'm using Handlebars templates in JavaScript that's part of a SpringMVC 3.x web application.
* Project builds are done using ant.
* Neither Node.js nor Ruby are available on the Linux server.

Problem
-------

* I want to precompile Handlebars templates into JavaScript as part of the build process.
* That is, I don't want to precompile the templates locally and then have to check generated code into source control.
* Without Node.js or Ruby, the server doesn't support the Handlebars npm package nor the Ruby gem, so I can't go the straight-forward route.

Attempts at resolution
----------------------

[Gems-in-a-jar](http://blog.nicksieger.com/articles/2009/01/10/jruby-1-1-6-gems-in-a-jar/) worked well for Compass, but the Handlebars gem relies on native extensions and JRuby doesn't play nice with native extensions and wouldn't build them. I tried a couple of [proposed](https://stackoverflow.com/questions/15795942/how-to-enable-c-extension-support-in-jruby) [solutions](https://stackoverflow.com/questions/10895053/failed-to-build-gem-native-extension-with-jruby), but had no luck.

Other notes
-----------

I looked at [Handlebars.java](https://github.com/jknack/handlebars.java) but that seems to be geared more toward using Handlebars templates application-wide, which feels like overkill for my purposes.

I'm looking for a light-weight solution that doesn't create a lot of dependencies and would like to avoid potential maintenance headaches as much as possible.