scala 2.11.x akka 2.3.x와 함께 spray.io를 사용하고 싶습니다. spray.io의 Project Info 페이지에서 다음을 찾을 수 있습니다. 나는 스프레이 클라이언트를 사용하는 경우어떻게 할 수있는 spray.io 스칼라와 함께 2.11.1 akka 2.3.2
spray 1.3.1 is built against Scala 2.10.3 and Akka 2.3.0 as well as Scala 2.11.1 and Akka 2.3.2.
, 나는 어떤 문제를 충족하고 나는 스프레이 클라이언트가 akka 2.10.x에 의존되어, spray.io의 문서 페이지에서 다음을 찾을 :
akka-actor 2.2.x (with ‘provided’ scope, i.e. you need to pull it in yourself)
제공된 범위의 의미는 무엇입니까? scala 2.11.x akka 2.3.x로 작성된 프로그램의 다른 부분과 함께 어떻게 사용할 수 있습니까? 이 잘 컴파일하지만
scalaVersion := "2.11.1"
libraryDependencies += "com.typesafe.akka" %% "akka-actor" % "2.3.2"
libraryDependencies += "io.spray" % "spray-client" % "1.3.1"
하지만 실행 충족 : build.sbt와
import akka.actor.ActorSystem
import scala.concurrent.Future
object main {
def main(args: Array[String]) {
import spray.http._
import spray.client.pipelining._
implicit val system = ActorSystem()
import system.dispatcher // execution context for futures
val pipeline: HttpRequest => Future[HttpResponse] = sendReceive
val response: Future[HttpResponse] = pipeline(Get("http://spray.io/"))
}
}
:
편집
다음은 documentation page에 나와있는 간단한 사용 사례입니다 시간 오류 :
Uncaught error from thread [default-akka.actor.default-dispatcher-2] shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled for ActorSystem[default]
java.lang.NoClassDefFoundError: scala/runtime/AbstractPartialFunction$mcVL$sp
at ...
아니요, 작동하지 않으며 build.sbt 및 자체 포함 된 예제를 추가하여 내 질문을 다시 편집했습니다. 컴파일은 잘되지만 런타임 오류가 발생합니다. –
'libraryDependencies + = "io.spray"% "스프레이 클라이언트"% "1.3.1" "을'libraryDependencies + ="io.spray "%%"스프레이 클라이언트 "%"1.3.1 "'로 변경하십시오. io.spray와 spray-client 사이의 %는 두 배입니다. 현재 sbt에서는 Scala 2.11로 작성된 akka와 Scala 2.10으로 작성된 스프레이를 혼합합니다. 따라서 예외. –
감사합니다. 작동합니다. 왜 scalaVersion : = "2.11.1"을 알아 냈기 때문에 scala 2.10으로 빌드 된 것입니까? –