Scala不使用heroku示例

时间:2012-07-17 23:02:03

标签: scala heroku

我正在按照教程在Heroku上创建一个scala Web应用程序:https://devcenter.heroku.com/articles/scala

我完全复制了那个例子,但是当我运行

sbt clean compile stage

由于这些错误而无法编译:

[error] /home/ajcrites/dev/dyl/src/main/scala/Web.scala:1: object jboss is not a member of package org
[error] import org.jboss.netty.handler.codec.http.{HttpRequest, HttpResponse}
[error]            ^
[error] /home/ajcrites/dev/dyl/src/main/scala/Web.scala:2: object twitter is not a member of package com
[error] import com.twitter.finagle.builder.ServerBuilder
[error]            ^
[error] /home/ajcrites/dev/dyl/src/main/scala/Web.scala:3: object twitter is not a member of package com
[error] import com.twitter.finagle.http.{Http, Response}
[error]            ^
[error] /home/ajcrites/dev/dyl/src/main/scala/Web.scala:4: object twitter is not a member of package com
[error] import com.twitter.finagle.Service
[error]            ^
[error] /home/ajcrites/dev/dyl/src/main/scala/Web.scala:5: object twitter is not a member of package com
[error] import com.twitter.util.Future
[error]            ^
[error] 5 errors found

基本上,我认为这与我所拥有的包装中没有可用的finagle有关。但是,我不知道如何安装finagle,上面的教程和https://github.com/twitter/finagle都没有说明

我可以做些什么来编译?

2 个答案:

答案 0 :(得分:2)

如果取决于您想要使用的Scala和Finagle的版本,但要将Finagle添加到项目中,只需将以下内容添加到build.sbt

libraryDependencies += "com.twitter" % "finagle-core_2.9.1" % "1.11.0" exclude("org.apache.thrift", "libthrift")

libraryDependencies += "com.twitter" % "finagle-http_2.9.1" % "1.11.0"

libraryDependencies += "com.twitter" % "finagle-serversets_2.9.1" % "1.11.0" excludeAll(
  ExclusionRule(organization = "com.sun.jdmk"),
  ExclusionRule(organization = "com.sun.jmx"),
  ExclusionRule(organization = "javax.jms")
)

这个例子大约3个月,所以我相信你可以买到更新版本的Finagle。

答案 1 :(得分:0)

我尝试了代码,它对我有用。也许看看GitHub上的源是否有效:https://github.com/heroku/devcenter-scala