OpenMRS SDK--Setting JVM parameters

Hello all–

I’ve finally had a chance to play around with the OpenMRS SDK. Very cool, great to see a way to get an OpenMRS dev enviroment up relatively quickly.

One issue I’m having, however, when trying to start up the full PIH-EMR with it’s 40+ modules via openmrs-sdk:run is that Jetty is hanging during the “Building Hibernate Session Factory” step. This is presumably because I haven’t tuned my JVM memory parameters. When I run via Jetty through IntelliJ I set the following JVM options:

-Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m

Is there a preferred/possible way to set these parameters when starting up Jetty via the SDK?

Thanks! Mark

fyi @wdessin

If I’m reading this file right, it looks like you’re out of luck and would need to add this feature into the SDK by supporting either passing in parameters at runtime (I would recommend also enabling setting the debug port), or by supporting a configuration file or environment variable.

@raff, any thoughts?

I have an IntelliJ project with a run configuration that does openmrs-sdk:run and passes VM options for Xmx, etc. I’m pretty sure I set it up this way because @raff suggested it.

So…maybe you can pass them at the command line, or else via a run configuration in the IDE.

Thanks @darius. @mogoodrich and @wdessin, I’m guessing that the file I pointed to above is an outdated repository that has been replaced by this one for the SDK. So my previous comment is probably invalid.


@mogoodrich, SDK uses maven memory settings. If you want it to work from command line you need to set MAVEN_OPTS. If you choose IDE then as Darius said simply specify VM arguments.

I’ve added a note to about setting the MAVEN_OPTS environment property. The benefit of doing it globally is that you will have it setup for all maven builds from command line (note that you will still have to pass VM arguments when using SDK from IDEs as they do not use MAVEN_OPTS).


Thanks @raff @darius, that did the trick. I had tried setting MAVEN_OPTS previously, but I must have been doing it wrong. I don’t know why I didn’t think of the IDE option that Darius mentioned, but that worked for me.