hakandilek / play2-crud

Simple CRUD & DAO implementation for play2
Other
142 stars 52 forks source link

Not working with 2.3 #38

Closed CodeCraftStudio closed 10 years ago

CodeCraftStudio commented 10 years ago

Play team moved template system to new project play.twirl.api. So we need few changes: import play.mvc.Content -> import play.twirl.api.Content import play.api.templates.Html -> import play.twirl.api.Html

http://www.playframework.com/documentation/2.3.x/Migration23

Unfortunetly more need to be fixed. When I change imports, compiler crashes on the wrong number of parameters in Assets (return controllers.Assets.at(path, file);)

hakandilek commented 10 years ago

Hi Łukasz, thanks for letting me know. Can you help with this one?

CodeCraftStudio commented 10 years ago

I can try, but I don't know Scala, and I'm just starting with Play. When I add boolean (for testing) to controllers.Assets.at(path, file, false/true), this problem disappears, but another one (in Scala) appear.

gbersac commented 10 years ago

I recently switched a project which version was 2.3 to version 2.2 in order to use play2-crud.

Configuration

Switching from to another was quite a nightmare. I ended up copy paste almost every conf file of the activator sample project of play2-crud.

Play 2.3 configuration file

build.sbt

name := """appGestion"""

version := "1.0-SNAPSHOT"

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

scalaVersion := "2.11.1"

resolvers += "jBCrypt Repository" at "http://repo1.maven.org/maven2/org/"

libraryDependencies ++= Seq(
    javaJdbc,
    javaEbean,
    cache,
    javaWs,
    "mysql" % "mysql-connector-java" % "5.1.+",
    "org.mindrot" % "jbcrypt" % "0.3m"
)

plugin.sbt

resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"

// The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.1")

// web plugins

addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-jshint" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-rjs" % "1.0.1")

addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-mocha" % "1.0.0")

Play 2.2 configuration file

build.sbt

name := """appGestion"""

version := "0.7.3-SNAPSHOT"

scalaVersion := "2.10.1"

resolvers += "jBCrypt Repository" at "http://repo1.maven.org/maven2/org/"

libraryDependencies ++= Seq(
    javaJdbc, javaCore,
    javaEbean,
    cache,
    "mysql" % "mysql-connector-java" % "5.1.+",
    "org.mindrot" % "jbcrypt" % "0.3m",
    "play2-crud" % "play2-crud_2.10" % "0.7.3-SNAPSHOT"
)

play.Project.playJavaSettings

resolvers += "release repository" at  "http://hakandilek.github.com/maven-repo/releases/"

resolvers += "snapshot repository" at "http://hakandilek.github.com/maven-repo/snapshots/"

plugin.sbt

resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"

// The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.2")

// web plugins

addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-jshint" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-rjs" % "1.0.1")

addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-mocha" % "1.0.0")

This are the two main file I had to change. I don't exactly remembered the other changes and I never knew if this changes were relevant.

Issues

Becausse of the downgrade, here is some of the issue I had to face: removing twirl import. Not that important since I used this import to create a less-effective implementation of crud2-play. Using the deprecated class SimpleResult. We use this class in the actions for example (which can't be used in the CRUDController, another issue about it later). Using the deprecated play.mvc.Content class.

Hope it will help you upgrade to the version 2.3. This will make this plugin even better !