播放框架错误:未找到:类型模型

时间:2013-09-28 17:41:36

标签: model compiler-errors playframework-2.0 migration playframework-2.2

我在播放框架中将2.0应用迁移到2.2,该应用可在以下位置找到:https://github.com/biesior/Play-20-Sample-FullCalendar-Java

编译时只有一个神秘错误:

\Play-20-Sample-FullCalendar-Java-master\app\models\Event.java:14: **not found: type Model**
[error] public class Event extends Model {
[error]                            ^
[error] one error found
[error] (compile:compile) Compilation failed`enter code here`
[error] Total time: 3 s, completed Sep 28, 2013 12:32:00 AM
[FullCalendar] $

文件models / Event.java:

package models;


import com.avaje.ebean;
import play.data.format.Formats;
import play.data.validation.Constraints;
import play.db.ebean;
import javax.persistence.Entity;
import javax.persistence.Id;
import java.util.Date;
import java.util.List;

@Entity
public class Event extends Model {

    @Id
    public Long id;

plugins.sbt文件:

// Comment to get more information during initialization
logLevel := Level.Warn

// 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.0")

Build.scala:

import sbt._
import Keys._
import play.Project._

object ApplicationBuild extends Build {

  val appName = "FullCalendar"
  val appVersion = "1.1.2-Snapshot"

  val appDependencies = Seq(
    javaEbean 
  )

  val main = play.Project(appName, appVersion, appDependencies).settings(
    // Add your own project settings here
  )

}

有什么见解?

谢谢。

1 个答案:

答案 0 :(得分:0)

注意你的进口。

您拥有import com.avaje.ebean;import play.db.ebean;个导入。这种进口是非法的。您可以将其更改为import com.avaje.ebean.*;import play.db.ebean.*;(或特别是import play.db.ebean.Model;)以使其正常工作