Skip to content

Instantly share code, notes, and snippets.

@labe-me
Created January 13, 2016 22:55
Show Gist options
  • Save labe-me/12a297538ea319b32b90 to your computer and use it in GitHub Desktop.
Save labe-me/12a297538ea319b32b90 to your computer and use it in GitHub Desktop.
Enabling DCEVM and Hotswap Agent in SBT + sbt-revolver plugin
val hotswapAgentJarPath = Def.settingKey[Option[String]]("Path to hotswap-agent.jar, enables DCEVM in run and reStart")
// set hotswapAgentJarPath := Some("/Users/lbedubourg/local/hotswap-agent.jar")
hotswapAgentJarPath := sys.env.get("HOTSWAP_AGENT_JAR")
def hotswapJavaOptions(path: Option[String]) = path match {
case None => Seq()
case Some(p) => Seq("-XXaltjvm=dcevm", s"-javaagent:${p}=autoHotswap=true")
}
// fork is required to get a new jvm with our custom args
fork in run := true
// add DCEVM jvm args to run task when hotswapAgentJarPath is defined
javaOptions in run <++= hotswapAgentJarPath map hotswapJavaOptions
// add DCEVM jvm args to sbt-revolver reStart task when hotswapAgentJarPath is defined
javaOptions in reStart <++= hotswapAgentJarPath map hotswapJavaOptions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment