javascalaintellij-ideascalatescalatra

Cannot resolve errors for Scalatra project in Intellij IDEA IDE


Im using IntelliJ Idea IDE for working on a scalatra project i created using giter8.I use sbt to run the project.When i open the project in IntelliJ , i get the following errors in MyScalatraServlet.scala:

Cannot resolve symbol scalate
Cannot resolve symbol ScalatraServlet
Cannot resolve symbol ScalateSupport

The code for MyScalatraServlet.scala is as follows:

import org.scalatra._
import java.net.URL
import scalate.ScalateSupport

class MyScalatraServlet extends ScalatraServlet with ScalateSupport {

  get("/") {
    <html>
      <body>
        <h1>Hello, world!</h1>
        Say <a href="hello-scalate">hello to Scalate</a>.
      </body>
    </html>
  }

  notFound {
    // Try to render a ScalateTemplate if no route matched
    findTemplate(requestPath) map { path =>
      contentType = "text/html"
      layoutTemplate(path)
    } orElse serveStaticResource() getOrElse resourceNotFound() 
  }
}

Any way i can resolve these dependencies ?. If not any way to hide these cannot resolve errors in IntelliJ ?

Please Help Thank You


Solution

  • You need to use the sbt-idea sbt pluging to generate the dependencies in a way Intellij can read them (xml files with the dependecies)