1

我正在尝试完全按照教程所说的去做,但我一直遇到这个错误。该教程是第一个要做的事情。(所以来源与此处完全相同)

   [info]   [SUCCESSFUL ] org.easytesting#fest-util;1.1.6!fest-util.jar (293ms)
   [info] Done updating.
   [info] Compiling 4 Scala sources and 3 Java sources to /tmp/build_3oqhsaxc7iatb/target/scala-2.10/classes...
   [error] /tmp/build_3oqhsaxc7iatb/app/controllers/Application.java:6: object data is not a member of package play
   [error] import play.data.validation.Constraints.*;
   [error]        ^
   [error] /tmp/build_3oqhsaxc7iatb/app/controllers/Application.java:7: object data is not a member of package play
   [error] import play.data.*;
   [error]        ^
   [error] /tmp/build_3oqhsaxc7iatb/app/models/Task.java:5: object db is not a member of package play
   [error] import play.db.ebean.*;
   [error]        ^
   [error] /tmp/build_3oqhsaxc7iatb/app/models/Task.java:6: object data is not a member of package play
   [error] import play.data.validation.Constraints.*;
   [error]        ^
   [error] /tmp/build_3oqhsaxc7iatb/app/models/Task.java:8: object persistence is not a member of package javax
   [error] import javax.persistence.*;
   [error]        ^
   [error] /tmp/build_3oqhsaxc7iatb/app/models/Task.java:11: not found: type Model
   [error] public class Task extends Model{
   [error]                           ^
   [error] /tmp/build_3oqhsaxc7iatb/app/views/index.scala.html:6: Int does not take parameters
   [error]  <h1>@tasks.size() task(s)</h1>
   [error]                 ^
   [error] 7 errors found
   [error] (compile:compile) Compilation failed
   [error] Total time: 116 s, completed May 19, 2013 8:37:52 PM

!使用 sbt 构建应用程序失败!Heroku 推送被拒绝,无法编译 Play 2.x - java 应用

4

1 回答 1

1

好的,看来我的问题只是项目/Build.scala 文件,这是一个工作版本:

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

object ApplicationBuild extends Build {

  val appName         = "todolist"
  val appVersion      = "1.0-SNAPSHOT"

  val appDependencies = Seq(
    // Add your project dependencies here,
    javaCore,
    javaJdbc,
    javaEbean,
    "postgresql" % "postgresql" % "9.1-901.jdbc4"
  )

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

}

我按照本教程进行操作,但没有正确理解如何设置 Build.scala 文件。

于 2013-08-05T21:25:51.417 回答