5
votes

Im trying to follow the play framework ebean tutorial here:

http://www.playframework.com/documentation/2.1.2/JavaEbean

However when I try to include play.db.ebean.* and try to compile, the package is not found (no play.db package). I have added ebean.default="models.*" to my application.conf

Is there anything else I need to do to get the dependency? Is there an equivalent to play deps from play 1.2 for example?

The trace:

[error] /home/nfv/workspace-scala/scims/app/models/Person.scala:3: object db is not a member of package play
[error] import play.db.ebean.Model;
[error]             ^
[error] /home/nfv/workspace-scala/scims/app/models/Person.scala:5: not found: type Model
[error] class Person extends Model {
[error]                      ^
[error] two errors found
[error] (compile:compile) Compilation failed
[error] Total time: 4 s, completed 09-Sep-2013 11:23:00

Cheers NFV

2
What does your Build.scala look like?maba

2 Answers

2
votes

This is probably because of a missing dependency in your Build.scala file.

To use Ebean, it should include a dependency on javaEbean. Ex :

val appDependencies = Seq(
  jdbc,
  javaEbean,
  ...)

After adding the dependency, run reload and update from the play console.

3
votes

I would recommend to follow https://playframework.com/documentation/2.4.x/Migration24 as you are not meant to specify "javaEbean" in the build.sbt file any more.

Now in the build.sbt you have to put:

lazy val root = (project in file(".")).enablePlugins(PlayJava, PlayEbean) 

Next uncomment the following lines in the "conf/application.conf".

db.default.driver=org.h2.Driver
db.default.url="jdbc:h2:mem:play"
ebean.default="models.*"

And lastly put the following line in "project/plugins.sbt"

addSbtPlugin("com.typesafe.sbt" % "sbt-play-ebean" % "1.0.0")