From 0b38b0bc00a645025e96f4f1b9c8881448c4a427 Mon Sep 17 00:00:00 2001 From: Alexandre Archambault Date: Wed, 24 Feb 2016 20:42:13 +0100 Subject: [PATCH] Allow to specify Java options in the generated bootstraps --- cli/src/main/scala-2.11/coursier/cli/Coursier.scala | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cli/src/main/scala-2.11/coursier/cli/Coursier.scala b/cli/src/main/scala-2.11/coursier/cli/Coursier.scala index cc4845190..0366ea41d 100644 --- a/cli/src/main/scala-2.11/coursier/cli/Coursier.scala +++ b/cli/src/main/scala-2.11/coursier/cli/Coursier.scala @@ -375,6 +375,10 @@ case class Bootstrap( @Value("key=value") @Short("P") property: List[String], + @Help("Set Java command-line options in the generated launcher.") + @Value("option") + @Short("J") + javaOpt: List[String], @Recurse isolated: IsolatedLoaderOptions, @Recurse @@ -552,10 +556,10 @@ case class Bootstrap( outputZip.close() - + // escaping of javaOpt possibly a bit loose :-| val shellPreamble = Seq( "#!/usr/bin/env sh", - "exec java -jar \"$0\" \"$@\"" + "exec java -jar " + javaOpt.map(s => "'" + s.replace("'", "\\'") + "'").mkString(" ") + " \"$0\" \"$@\"" ).mkString("", "\n", "\n") try NIOFiles.write(output0.toPath, shellPreamble.getBytes("UTF-8") ++ buffer.toByteArray)