2015-05-05 27 views
0

我試圖安裝SBT /舒巴坦與徵兵有關OSX試圖運行一個腳本階,當安裝徵兵錯誤 「SBT/SBT」

cs sbt/sbt --branch 0.13.8

繼SBT DOC: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 

scalasscrepl似乎正確安裝?但是,當我試圖執行以下腳本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) 
...... 

有人可以建議嗎?

+0

錯誤似乎是「--version」標誌的錯誤https://github.com/sbt/sbt/issues/1857#issuecomment-74183037 – maow

回答

0

事實證明最後註釋行頭部的空白(" */")失敗。 IntelliJ自動添加空間來美化註釋(或者它是scala約定添加空格?),但scalas不會去除它。