Explosion Pills
Explosion Pills

Reputation: 191749

Scala not working with heroku example

I'm following a tutorial to create a scala web app with Heroku here: https://devcenter.heroku.com/articles/scala

I've copied there example exactly, but when I run

sbt clean compile stage

It fails to compile because of these errors:

[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

Basically, I think it has to do with finagle not being available or not in the packages I have or something. However, I have no idea how to install finagle and there are neither instructions in the tutorial above nor at https://github.com/twitter/finagle

What can I do to get this to compile?

Upvotes: 1

Views: 855

Answers (2)

James Ward
James Ward

Reputation: 29433

I tried the code and it worked for me. Perhaps see if the source on GitHub works: https://github.com/heroku/devcenter-scala

Upvotes: 0

Jack
Jack

Reputation: 16718

If will depend on the version of Scala and Finagle you want to use, but to add Finagle to the project, just add the following to 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")
)

This example is about 3 months old, so I'm sure you can get a newer version of Finagle.

Upvotes: 2

Related Questions