Would you recommend running a production server using gradle?

I am considering the best way to deploy a production server using gradle. It is a jruby on rails app that we’re using gradle with in order to integrate it with some shared java code. Another benefit of using gradle for this is not having to worry about working with rbenv or rvm for ruby version management on the deployment server – something I’ve done before which is not always very fun. Running it with gradle lets me treat jruby strictly as java and gets rid of much of the ruby version hassle.

I’m wondering where this line should stop though. Perhaps the role of gradle should be just to setup the environment on the server and then have jruby installed to actually start the rails process (using something like trinidad, perhaps). Though, I’m considering the possibility of just letting gradle do the whole thing and run the trinidad server directly from the gradle process.

Is this a good / bad idea? Has anyone done this before?

You definitely can do this, and people have, particularly on cloud platforms like Heroku.

The one thing you’d want to make sure of though is that when you launch the app you don’t hold the Gradle process open as it’s going to sit there reserving memory for not much purpose. Most people do this buy having the Gradle build build a runnable image (e.g. install jruby and all other bits into a specified location) and then launch via a shell script or similar. That said, I know some people just launch the process from Gradle and let it stay open.