How to pass command line args to program in SBT 0.13.1?

Viewed 12027

I just switched to SBT 0.13.1 and either arg handling changed or there's a bug. Here's what I'm testing with (named sbt-test.scala):

#!/bin/sh
SBT_0_13_0="/path/to/sbt-launch-0.13.0.jar"
SBT_0_13_1="/path/to/sbt-launch-0.13.1.jar"
SBT="$SBT_0_13_1"
exec java $JAVA_OPTS -Dsbt.main.class=sbt.ScriptMain -jar "$SBT" $0 "$@"
!#

/***
scalaVersion := "2.10.3"

libraryDependencies ++= Seq(
  "com.typesafe" % "config" % "1.0.0"
)
*/

import com.typesafe.config.{ConfigFactory, Config}

println(s"Args: ${args mkString ", "}")

val cfg = ConfigFactory.parseString(
  """
    |credentials {
    |  user = someone
    |  pass = s3cr3t
    |}
  """.stripMargin)

println(cfg getString "credentials.user")

When I run ./sbt-test.scala --arg=val I get the following error:

[error] Expected ID character
[error] Not a valid command: arg
[error] arg=val

Running the same script with the same argument with SBT 0.13.0 yields the expected:

Args: --arg=val
someone

Similarly, if I turn that executable script into an actual SBT project and attempt to run sbt run --flag I get

[error] Not a valid command: flag (similar: iflast, last, alias)
[error] flag
1 Answers
Related