Skip to content

Instantly share code, notes, and snippets.

@flowersinthesand
Created October 2, 2013 06:54
Show Gist options
  • Save flowersinthesand/6789935 to your computer and use it in GitHub Desktop.
Save flowersinthesand/6789935 to your computer and use it in GitHub Desktop.
Migration to Play 2.2
diff --git a/play/pom.xml b/play/pom.xml
index 1153e08..27c4100 100644
--- a/play/pom.xml
+++ b/play/pom.xml
@@ -16,7 +16,7 @@
<artifactId>portal-core</artifactId>
</dependency>
<dependency>
- <groupId>play</groupId>
+ <groupId>com.typesafe.play</groupId>
<artifactId>play_2.10</artifactId>
</dependency>
<dependency>
diff --git a/play/src/main/scala/com/github/flowersinthesand/portal/play/Handlers.scala b/play/src/main/scala/com/github/flowersinthesand/portal/play/Handlers.scala
index 909e9e1..f095536 100644
--- a/play/src/main/scala/com/github/flowersinthesand/portal/play/Handlers.scala
+++ b/play/src/main/scala/com/github/flowersinthesand/portal/play/Handlers.scala
@@ -21,9 +21,11 @@
import play.core._
import play.core.j._
import play.mvc.Http.RequestHeader
+import play.libs.F.Promise
import com.github.flowersinthesand.portal.App
+// For 2.2.0+
object Handlers {
def get(request: RequestHeader): Handler = {
@@ -44,21 +46,21 @@
case _ => new JavaAction {
val annotations = new JavaActionAnnotations(c, c.getMethod("httpOut"))
val parser = annotations.parser
- def invocation = b.httpOut
+ def invocation = Promise.pure(b.httpOut)
}
}
}
case "abort" => new JavaAction {
val annotations = new JavaActionAnnotations(c, c.getMethod("abort"))
val parser = annotations.parser
- def invocation = b.abort
+ def invocation = Promise.pure(b.abort)
}
}
}
case "POST" => new JavaAction {
val annotations = new JavaActionAnnotations(c, c.getMethod("httpIn"))
val parser = annotations.parser
- def invocation = b.httpIn
+ def invocation = Promise.pure(b.httpIn)
}
}
}
diff --git a/pom.xml b/pom.xml
index 886497a..9ed2be8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -127,9 +127,9 @@
<version>3.0</version>
</dependency>
<dependency>
- <groupId>play</groupId>
+ <groupId>com.typesafe.play</groupId>
<artifactId>play_2.10</artifactId>
- <version>2.1.5</version>
+ <version>2.2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
diff --git a/samples/chat-play/project/Build.scala b/samples/chat-play/project/Build.scala
index ef3d111..2ee0930 100644
--- a/samples/chat-play/project/Build.scala
+++ b/samples/chat-play/project/Build.scala
@@ -20,6 +20,14 @@
// "com.github.flowersinthesand" % "portal-play" % "${portal.version}"
)
- val main = play.Project(appName, appVersion, appDependencies).settings()
+ // play2-maven-plugin 1.2.2 can't handle new dist structure of Play 2.2.0
+ // workaround by @maccamlc
+ // https://github.com/nanoko-project/maven-play2-plugin/issues/15#issuecomment-24977753
+ val distFolder = new File("target/dist")
+ distFolder.mkdirs()
+
+ val main = play.Project(appName, appVersion, appDependencies).settings(
+ target in com.typesafe.sbt.SbtNativePackager.Universal := distFolder
+ )
}
diff --git a/samples/chat-play/project/build.properties b/samples/chat-play/project/build.properties
index 66ad72c..0974fce 100644
--- a/samples/chat-play/project/build.properties
+++ b/samples/chat-play/project/build.properties
@@ -1 +1 @@
-sbt.version=0.12.2
+sbt.version=0.13.0
diff --git a/samples/chat-play/project/plugins.sbt b/samples/chat-play/project/plugins.sbt
index fae77de..c7a84ee 100644
--- a/samples/chat-play/project/plugins.sbt
+++ b/samples/chat-play/project/plugins.sbt
@@ -5,4 +5,4 @@
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
// Use the Play sbt plugin for Play projects
-addSbtPlugin("play" % "sbt-plugin" % Option(System.getProperty("play.version")).getOrElse("2.0"))
\ No newline at end of file
+addSbtPlugin("com.typesafe.play" % "sbt-plugin" % System.getProperty("play.version"))
\ No newline at end of file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment