在Play Framework 2.3.0(Java)的build.sbt中定义JAVA_OPTS
作者:互联网
我正在尝试在build.scala中定义JAVA_OPTS,以便为运行和测试任务指定调试端口和配置文件,但是它不起作用.我启动激活器,然后运行或测试.
这是我的build.sbt:
name := "machinchose"
version := "1.0-SNAPSHOT"
lazy val root = (project in file(".")).enablePlugins(PlayJava)
scalaVersion := "2.11.1"
libraryDependencies ++= Seq(
javaJdbc,
javaEbean,
cache,
javaWs
)
Keys.fork in run := true
javaOptions in run ++= Seq(
"-Xdebug",
"-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9997",
"-Dconfig.file=conf/developpement.conf",
"-Xms128m",
"-Xmx1024m"
)
Keys.fork in Test := true
javaOptions in Test ++= Seq(
"-Xdebug",
"-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9997",
"-Dconfig.file=conf/test.conf",
"-Xms128m",
"-Xmx1024m"
)
我搞砸了什么?谢谢你的帮助.
解决方法:
Play并不真正支持分叉.可能只是忽略了该设置.因此,由于没有新的JVM,您的javaOptions将无法工作.您要做的就是使用这些选项启动激活器(或sbt)本身,或者设置环境变量JAVA_OPTS,SBT_OPTS或ACTIVATOR_OPTS之一.还有一个-jvm-debug到激活器以添加调试器.
标签:typesafe-activator,playframework-2-3,sbt,playframework,java 来源: https://codeday.me/bug/20191121/2052692.html