Play 2.2中的奇怪错误

时间:2013-12-22 12:57:23

标签: scala intellij-idea playframework sbt playframework-2.2

我不能让Play 2.2正常工作。

//project/Build.scala
object ApplicationBuild extends Build {
  val appName = "fdsfdsfd"
  val appVersion = "1.0-SNAPSHOT"

  val appDependencies = Seq(jdbc, anorm)

  val main = play.Project(appName, appVersion, appDependencies)
  lazy val buildSettings = Seq(
    organization := "123",
    version := "432432",
    scalaVersion := "2.10.3"
  )
}

//project/plugins.scala
// Comment to get more information during initialization
logLevel := Level.Debug

// The Typesafe repository 
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"

// Use the Play sbt plugin for Play projects
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.1")

//project/build.properties
sbt.version=0.13.0

但这是一个错误

//Auth.scala

import play.api.mvc._
import play.api.mvc.Security.Authenticated

object Auth extends ActionBuilder[String] {
  def onUnauthorized(request: RequestHeader) = Results.Redirect(routes.Application.login) //error - there is no such a method "login"
     //error: routes.Application returns Nothing

  //.....
}

//Application.scala
object Application extends Controller {

    def login = Action {
    Ok(views.html.index())
  }
}

//routes
GET        /login            controllers.Application.login

我做了gen-idea以及更多其他命令,例如clean, reload - 没有任何帮助。

奇怪的是它出于某种原因使用了scala 2.10,即使如此我默认情况下也存在scala 2.10.3。看这张图片: enter image description here

我删除了target/scala_2.10,但错误一直在反复出现。

0 个答案:

没有答案