简体   繁体   English

似乎无法在 SBT 的分叉 JVM 中运行 Play 应用程序

[英]Cannot seem to run Play application in a forked JVM from within SBT

I have a Scala Play Framework web-application (using Scala v2.13.7 and Play v2.8.8) built using SBT (v1.5.5).我有一个使用SBT (v1.5.5) 构建的Scala Play Framework web 应用程序(使用Scala v2.13.7 和Play v2.8.8)。

My build.sbt includes the following:我的build.sbt包括以下内容:

lazy val root = (project in file("."))
.enablePlugins(PlayScala)
.settings(

  // etc.

  fork := true,
  javaOptions ++= Seq(
    "-Xms1G",
    "-Xmx8G",
  ),
)

However, a separate JVM for the web-application is not spawned when I execute sbt run , and the memory settings are those of the SBT JVM ( -Xms1024m and -Xmx1024m ). However, a separate JVM for the web-application is not spawned when I execute sbt run , and the memory settings are those of the SBT JVM ( -Xms1024m and -Xmx1024m ).

Does the PlayScala plugin interfere with or disable forking when running the web-application itself?运行 Web 应用程序本身时, PlayScala插件是否会干扰或禁用分叉? Can I force the web-application to use a forked JVM from within SBT ?我可以强制 Web 应用程序在 SBT 中使用分叉的JVM吗?

Based on the sbt documentation, Forked JVM Options , you may want to do something like:根据 sbt 文档, Forked JVM Options ,您可能想要执行以下操作:

lazy val root = (project in file("."))
.enablePlugins(PlayScala)
.settings(

  // etc.

  javaOptions ++= Seq(
    "-Xms1G",
    "-Xmx8G",
  ),
  fork := true,
  run / javaOptions += "-Xms1G -Xmx8G",
)

I'm not very familiar with play, but this should resolve the issue you're facing.我对游戏不是很熟悉,但这应该可以解决您面临的问题。

Sparing myself a long investigation on my part, if all you want to do is affect java options, set them (all in one or one per line is ok) in a file named .jvmopts in the sbt project root folder (-as mentioned elsewhere already).如果您只想影响 java 选项,请不要对我自己进行长时间的调查,请将它们设置(所有在一个或每行一个都可以)在 sbt 项目根文件夹中名为.jvmopts的文件中(如其他地方所述已经)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM