2017-08-21 239 views
0

我想建立一個簡單的SBT項目,但它與一個惱人的錯誤而失敗:SBT啓動失敗

λ sbt 
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0 
[info] Loading global plugins from C:\Users\name.surname\.sbt\0.13\plugins 
[info] Loading project definition from C:\work\ScalaKafkaScripts\project 
[error] [C:\work\ScalaKafkaScripts\build.sbt]:9: illegal start of simple expression 
[error] [C:\work\ScalaKafkaScripts\build.sbt]:12: ')' expected but eof found. 
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? 

這裏是build.sbt全部內容:

import Dependencies._ 

lazy val root = 
    (project in file(".")) 
     .settings(
     inThisBuild(List(
      organization := "yo.jevramonitor", 
      scalaVersion := "2.12.1", 
     )), 
     name := "ScalaKafkaScripts", 
     libraryDependencies ++= allDeps 
    ) 

這裏是Dependencies文件內容:

import sbt._ 

object Dependencies { 
    lazy val kafka = "org.apache.kafka" %% "kafka_2.11" % "0.10.1.0" 
    lazy val allDeps = Seq(kafka) 
} 

這裏是目錄結構:

Directory Structure

回答

1

scalaVersion := "2.12.1",卸下後面的逗號。像斯卡拉本身尾隨逗號沒有在SBT語法,即允許,你可以有

Seq("foo", "bar") 

但不

Seq("foo", "bar",) 
+1

FFS,SBT是與錯誤信息可怕的無助:(非常感謝 – eddyP23

+0

諷刺,現在如果您使用SBT 1(使用2.12),那麼現在就可以使用尾隨逗號。 – Grogs