我是Scala的新手。雖然試圖用阿卡,我收到以下錯誤Scala 2.11.4,akka 2.3.7,spray 1.3.1給出類型不匹配錯誤
Error:(17, 17) type mismatch;
found : String("Welcome to Scala")
required: spray.httpx.marshalling.ToResponseMarshallable
complete("Welcome to Scala")
代碼噴塗:嚴格
<dependencies>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>${scala.version}</version>
</dependency>
<dependency>
<groupId>org.specs</groupId>
<artifactId>specs</artifactId>
<version>1.2.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.spray</groupId>
<artifactId>spray-routing</artifactId>
<version>${spray.version}</version>
</dependency>
<dependency>
<groupId>io.spray</groupId>
<artifactId>spray-can</artifactId>
<version>${spray.version}</version>
</dependency>
<dependency>
<groupId>io.spray</groupId>
<artifactId>spray-httpx</artifactId>
<version>${spray.version}</version>
</dependency>
<dependency>
<groupId>io.spray</groupId>
<artifactId>spray-client</artifactId>
<version>${spray.version}</version>
</dependency>
<dependency>
<groupId>io.spray</groupId>
<artifactId>spray-json_2.11</artifactId>
<version>${spray.version}</version>
</dependency>
<dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-actor_2.11</artifactId>
<version>${akka.version}</version>
</dependency>
</dependencies>
井採用的是IntelliJ IDEA的14
正相關性:
import spray.routing._
import akka.actor._
object SampleApplication extends App with SimpleRoutingApp {
implicit val actorSystem = ActorSystem()
startServer(interface = "localhost", port = 8080) {
get {
path("hello") {
complete {
"Welcome to Scala"
}
}
}
}
}
Maven依賴綁定到Scala版本?
請幫忙解決問題。
你的例子運行良好 - 你如何運行它? ide,sbt ....? – 2014-12-05 08:46:38
使用maven和Intellij IDEA – 2014-12-05 10:27:20
任何人如何幫助您提供您所提供的信息? - 你應該在你的問題中提供這個 - 包括你的maven配置 - 或者更好:在github或者bitbucket上鍊接到你的項目... – 2014-12-05 11:31:31