通过 James Ward 的Play2Tutorial,我完成了最后一步,添加 Postgresql 数据库并推送到 Heroku。
我根据他的建议编辑了 Build.scala 文件:
val appDependencies = Seq(
"com.github.twitter" % "bootstrap" % "2.0.2",
"postgresql" % "postgresql" % "9.1-901-1.jdbc4"
)
并修改了我的 Procfile:
web: target/start -Dhttp.port=${PORT} -DapplyEvolutions.default=true -Ddb.default.driver=org.postgresql.Driver -Ddb.default.url=$DATABASE_URL ${JAVA_OPTS}
编译器在 localhost 上没有返回任何错误,Heroku postgresql 似乎添加得很好,但是“git push heroku master”在最后一刻失败了:
[info] Resolving org.scala-sbt#precompiled-2_9_2;0.11.3 ...
[info] Done updating.
[info] Compiling 1 Scala source to /tmp/build_3r8l8m531s747/.sbt_home/.sbt/plugins/target/scala-2.9.1/sbt-0.11.3/classes...
[info] Loading project definition from /tmp/build_3r8l8m531s747/project
[error] /tmp/build_3r8l8m531s747/project/Build.scala:12: ')' expected but string literal found.
[error] "postgresql" % "postgresql" % "9.1-901-1.jdbc4"
[error] ^
[error] one error found
[error] {file:/tmp/build_3r8l8m531s747/project/}default-f03173/compile:compile: Compilation failed
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? !
Failed to build app with sbt!
Heroku push rejected, failed to compile Play 2.0 - java app
To git@heroku.com:********
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:********'
该代码是文字复制和粘贴,我之前已经使用过它(已经完成了本教程,没有发生任何事故)。
希望您能提供任何建议。
谢谢,芯片