Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Play Framework will not recognize Java Options (JVM args) passed in Build.scala

All,

I'm trying to get Play Framework to recognize JVM arguments in all modes (test, run start) by setting them in Build.scala.

Unfortunately, Play ignores everything I've thrown at it.

I've set Keys.javaOptions and Keys.fork, but it SBT flat out ignores the fork command. I also tried going at this by replacing Build.scala with build.sbt, but that doesn't seem to work either.

I realize you can set JAVA_OPTS or PLAY_OPTS in your environment, but this is really lousy way of doing things. One should be able to configure this at the application level and play should be smart enough to either spawn a new process or re-launch itself with the appropriate configuration.

Anyone able to get this to work? If so, can you provide a complete, working solution?

like image 347
bitstream Avatar asked Oct 31 '25 09:10

bitstream


1 Answers

The Play Framework SBT keys override javaOptions you pass, and therefore it will not work. The way to do it ,according to the documentation, is to pass those arguments at the start command.

The syntax changes a bit from version to version, but at 2.2.x it is:

$ /path/to/bin/<project-name> -J-Xms128M -J-Xmx512m -J-server

like image 114
Kraylog Avatar answered Nov 04 '25 12:11

Kraylog