如何在 play/activator 中设置堆大小?

How to set heap size in play/activator?

当 运行 激活器时,我得到一个 "java.lang.OutOfMemoryError: Java heap space"。我想将堆设置为无限大小。我在其他地方读到我需要像这样更改 SBT_OPTS 或 _JAVA_OPTION:

export SBT_OPTS="-Xmx2G -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=2G -Xss2M  -Duser.timezone=GMT"

我在任何地方都找不到这方面的任何文档。

tl;dr activator -help

你可以使用JAVA_OPTS(可能影响其他java程序),SBT_OPTS(也影响sbt),ACTIVATOR_OPTS(只影响activator)还有一个-mem 您可以使用的标志。

我认为 -J-Xmx512M 也可以。

➜  ~ activator -help
Usage: activator <command> [options]

  Command:
  ui                 Start the Activator UI
  new [name] [template-id]  Create a new project with [name] using template [template-id]
  list-templates     Print all available template names
  -h | -help         Print this message

  Options:
  -v | -verbose      Make this runner chattier
  -d | -debug        Set sbt log level to debug
  -mem <integer>     Set memory options (default: , which is -Xms1024m -Xmx1024m -XX:MetaspaceSize=64m -XX:MaxMetaspaceSize=256m)
  -jvm-debug <port>  Turn on JVM debugging, open at the given port.

  # java version (default: java from PATH, currently java version "1.8.0_25")
  -java-home <path>  Alternate JAVA_HOME

  # jvm options and output control
  -Dkey=val          Pass -Dkey=val directly to the java runtime
  -J-X               Pass option -X directly to the java runtime
                     (-J is stripped)

  # environment variables (read from context)
  JAVA_OPTS          Environment variable, if unset uses ""
  SBT_OPTS           Environment variable, if unset uses ""
  ACTIVATOR_OPTS     Environment variable, if unset uses ""

In the case of duplicated or conflicting options, the order above
shows precedence: environment variables lowest, command line options highest.