Search code examples
playframeworkplayframework-2.0build-error

Build error in play framework


I am pretty new to play framework and just trying to run a basic java-play app (hello-play-java).But whenever I try to build it ,It gives this error:-

error: object Project is not a member of package play
import play.Project._
        ^
Type error in expression
Failed to load project.`

My build.sbt file is as follows:-

import play.Project._

name := """hello-play-java"""

version := "1.0-SNAPSHOT"

libraryDependencies ++= Seq(
"org.webjars" %% "webjars-play" % "2.2.2", 
"org.webjars" % "bootstrap" % "2.3.1")

playJavaSettings


fork in run := true

I tried googling it but didnt find much help.


Solution

  • If you're using Play 2.3, you don't need that import. This should work:

    name := """hello-play-java"""
    
    version := "1.0-SNAPSHOT"
    
    libraryDependencies ++= Seq(
    "org.webjars" %% "webjars-play" % "2.2.2", 
    "org.webjars" % "bootstrap" % "2.3.1")
    
    fork in run := true
    

    You can see an example here.