Created
December 14, 2012 21:46
-
-
Save tlockney/4288931 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val javaRuntimeOptions = Seq( | |
"-Xmx2048M", | |
"-XX:+UseConcMarkSweepGC", | |
"-XX:+CMSClassUnloadingEnabled", | |
"-XX:MaxPermSize=512M", | |
"-Xshare:off", | |
"-Dcom.sun.management.jmxremote.port=9998", | |
"-Dcom.sun.management.jmxremote.authenticate=false", | |
"-Dcom.sun.management.jmxremote.ssl=false", | |
"-Djava.rmi.server.hostname=%s".format(hostname), | |
"-Djava.rmi.server.useLocalHostname=true", | |
"-XX:+HeapDumpOnOutOfMemoryError", | |
"-XX:HeapDumpPath=./" | |
) | |
settings += (resourceGenerators in Compile) <+= (resourceManaged, version) map { (dir, version) => | |
val runScript = dir / "scriptName" | |
IO.write(runScript, genRunScript(version)) | |
Seq(runScript) | |
} | |
def genRunScript(version: String) = { | |
val runtimeOptions = javaRuntimeOptions.mkString(" \\\n") | |
"""#!/bin/sh | |
| | |
|java -classpath ./appname-%s.jar:. \ | |
|%s \ | |
|foo.bar.MainClass""".stripMargin.format(version, runtimeOptions) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment