尝试 运行 一个 scala 脚本,安装时出现 conscript 错误 "sbt/sbt"
Trying to run a scala script, conscript errors when install "sbt/sbt"
我正在尝试在 OSX
上安装 sbt/sbt
cs sbt/sbt --branch 0.13.8
遵循 sbt 文档:http://www.scala-sbt.org/release/docs/Scripts.html
我收到以下错误:
.......
[SUCCESSFUL ] org.scala-sbt#apply-macro;0.13.6!apply-macro.jar (4702ms)
:: retrieving :: org.scala-sbt#boot-app
confs: [default]
44 artifacts copied, 0 already retrieved (13750kB/113ms)
[error] Not a valid command: version (similar: session)
[error] version
[error] ^
[error] Not a valid command: version
[error] version
[error] ^
[error] Not a valid command: version
[error] version
[error] ^
Conscripted sbt/sbt to ~bin/sbt
Conscripted sbt/sbt to ~/bin/scalas
Conscripted sbt/sbt to ~/bin/screpl
scalas
和 screpl
似乎安装正确?但是,当我尝试执行以下脚本时 helloworld.scala
,
#!/usr/bin/env scalas
/***
scalaVersion := "2.11.6"
*/
println("hello")
我收到如下错误:
>./helloworld.scala
~ ./helloworld.scala:5: error: eof expected but ';' found.
*/
^
[error] Error parsing expression. Ensure that settings are separated by blank lines.
另一个脚本示例test.scala
:
#!/usr/bin/env scalas
/***
scalaVersion := "2.11.6"
libraryDependencies += "net.databinder.dispatch" %% "dispatch-core" % "0.11.2"
*/
import dispatch._, Defaults._
case class Location(city: String, state: String)
def weatherSvc(loc: Location) = {
host("api.wunderground.com") / "api" / "5a7c66db0ba0323a" /
"conditions" / "q" / loc.state / (loc.city + ".xml")
}
val nyc = Location("New York", "NY")
for (str <- Http(weatherSvc(nyc) OK as.String))
println(str)
我收到如下错误:
./test.scala:18: error: not found: value Location
val nyc = Location("New York", "NY")
^
./test.scala:14: error: not found: value host
host("api.wunderground.com") / "api" / "5a7c66db0ba0323a" /
^
./test.scala:13: error: not found: type Location
def weatherSvc(loc: Location) = {
^
sbt.compiler.EvalException: Type error in expression
at sbt.compiler.Eval.checkError(Eval.scala:384)
......
有人可以建议吗?
原来最后一行注释的白字space(" */"
)失败了。 IntelliJ 会自动添加 space 来美化评论(或者是添加白色 space 的 scala 约定?)但 scalas
不会删除它。
我正在尝试在 OSX
上安装 sbt/sbtcs sbt/sbt --branch 0.13.8
遵循 sbt 文档:http://www.scala-sbt.org/release/docs/Scripts.html
我收到以下错误:
.......
[SUCCESSFUL ] org.scala-sbt#apply-macro;0.13.6!apply-macro.jar (4702ms)
:: retrieving :: org.scala-sbt#boot-app
confs: [default]
44 artifacts copied, 0 already retrieved (13750kB/113ms)
[error] Not a valid command: version (similar: session)
[error] version
[error] ^
[error] Not a valid command: version
[error] version
[error] ^
[error] Not a valid command: version
[error] version
[error] ^
Conscripted sbt/sbt to ~bin/sbt
Conscripted sbt/sbt to ~/bin/scalas
Conscripted sbt/sbt to ~/bin/screpl
scalas
和 screpl
似乎安装正确?但是,当我尝试执行以下脚本时 helloworld.scala
,
#!/usr/bin/env scalas
/***
scalaVersion := "2.11.6"
*/
println("hello")
我收到如下错误:
>./helloworld.scala
~ ./helloworld.scala:5: error: eof expected but ';' found.
*/
^
[error] Error parsing expression. Ensure that settings are separated by blank lines.
另一个脚本示例test.scala
:
#!/usr/bin/env scalas
/***
scalaVersion := "2.11.6"
libraryDependencies += "net.databinder.dispatch" %% "dispatch-core" % "0.11.2"
*/
import dispatch._, Defaults._
case class Location(city: String, state: String)
def weatherSvc(loc: Location) = {
host("api.wunderground.com") / "api" / "5a7c66db0ba0323a" /
"conditions" / "q" / loc.state / (loc.city + ".xml")
}
val nyc = Location("New York", "NY")
for (str <- Http(weatherSvc(nyc) OK as.String))
println(str)
我收到如下错误:
./test.scala:18: error: not found: value Location
val nyc = Location("New York", "NY")
^
./test.scala:14: error: not found: value host
host("api.wunderground.com") / "api" / "5a7c66db0ba0323a" /
^
./test.scala:13: error: not found: type Location
def weatherSvc(loc: Location) = {
^
sbt.compiler.EvalException: Type error in expression
at sbt.compiler.Eval.checkError(Eval.scala:384)
......
有人可以建议吗?
原来最后一行注释的白字space(" */"
)失败了。 IntelliJ 会自动添加 space 来美化评论(或者是添加白色 space 的 scala 约定?)但 scalas
不会删除它。