play.db package not found in play 2.1.3
Asked Answered
F

2

5

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

Footpad answered 9/9, 2013 at 10:25 Comment(1)
What does your Build.scala look like?Holbein
A
2

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.

Asteroid answered 10/9, 2013 at 15:24 Comment(0)
R
3

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")
Ratline answered 29/7, 2015 at 9:50 Comment(0)
A
2

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.

Asteroid answered 10/9, 2013 at 15:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.