playframework-2.1

Adding Play JSON Library to sbt

徘徊边缘 提交于 2019-11-27 01:07:11
How can I add the Play JSON library ( play.api.libs.json ) to my sbt project? When I added the following to my plugins.sbt file: addSbtPlugin("play" % "sbt-plugin" % "2.1.0") I faced this error: [warn] :::::::::::::::::::::::::::::::::::::::::::::: [warn] :: UNRESOLVED DEPENDENCIES :: [warn] :::::::::::::::::::::::::::::::::::::::::::::: [warn] :: play#sbt-plugin;2.1.0: not found [warn] :::::::::::::::::::::::::::::::::::::::::::::: I did not find a resolver for this library, otherwise I would've added it and ran sbt update . Note that my resolvers includes http://repo.typesafe.com/typesafe

How to turn json to case class when case class has only one field

若如初见. 提交于 2019-11-27 00:27:38
In play 2.1 reads are used to marshall Json to objects. But how can I do this when the case class has only one field. The ideom that works for more fields does not work, as with one field 'and' is not used. Thus I do not get a FunctionBuilder. The following code gives me a type mismatch. How can I fix this? case class Data(stamm: Seq[String]) implicit val dataReads = ( (__ \ "stamm").read(Reads.list[String]) )(Data) Json combinators doesn't work for single field case class. Pascal (writer of this API) has explained this situation here https://groups.google.com/forum/?fromgroups=#!starred/play

Play Framework 2.1: Use play.api.Configuration in Build.scala

给你一囗甜甜゛ 提交于 2019-11-26 22:49:06
问题 In the top answer to Play Framework 2: Read the application version defined in Build.scala it's suggested that the application version number be specified in conf/application.conf and loaded in Build.scala through play.api.Configuration . I'm using Play 2.1-RC2 and getting the following error message when building: [error] [...]/project/Build.scala:7: object Configuration is not a member of package play.api [error] val conf = play.api.Configuration.load(new File(".")) I think this might be

scala.concurrent.Future wrapper for java.util.concurrent.Future

旧城冷巷雨未停 提交于 2019-11-26 21:09:30
问题 I'm using Play Framework 2.1.1 with an external java library that produces a java.util.concurrent.Future result. I'm using the scala future's as opposed to Akka which I think is the right thing to do as of Play 2.1. How can I wrap the java.util.concurrent.Future up into a scala.concurrent.Future while still keeping the code non-blocking? def geConnection() : Connection = { // blocking with get connectionPool.getConnectionAsync().get(30000, TimeUnit.MILLISECONDS) } The above code returns a

How to turn json to case class when case class has only one field

我只是一个虾纸丫 提交于 2019-11-26 12:22:06
问题 In play 2.1 reads are used to marshall Json to objects. But how can I do this when the case class has only one field. The ideom that works for more fields does not work, as with one field \'and\' is not used. Thus I do not get a FunctionBuilder. The following code gives me a type mismatch. How can I fix this? case class Data(stamm: Seq[String]) implicit val dataReads = ( (__ \\ \"stamm\").read(Reads.list[String]) )(Data) 回答1: Json combinators doesn't work for single field case class. Pascal

Build.scala, % and %% symbols meaning

社会主义新天地 提交于 2019-11-26 11:59:15
问题 I\'m new to Play! Framework 2.1 (java version) and have no experience with scala. I don\'t understand what are and what does % and %% mean in Build.scala. I googled about them but couldn\'t find their meaning. In my Build.scala file I have: \"org.hibernate\" % \"hibernate-entitymanager\" % \"4.1.0.Final\", \"com.typesafe\" %% \"play-plugins-mailer\" % \"2.1\" Why the first line uses a single % symbol and the second one uses two percent symbols %% ? What are they for? 回答1: From the official

Adding Play JSON Library to sbt

岁酱吖の 提交于 2019-11-26 09:34:33
问题 How can I add the Play JSON library ( play.api.libs.json ) to my sbt project? When I added the following to my plugins.sbt file: addSbtPlugin(\"play\" % \"sbt-plugin\" % \"2.1.0\") I faced this error: [warn] :::::::::::::::::::::::::::::::::::::::::::::: [warn] :: UNRESOLVED DEPENDENCIES :: [warn] :::::::::::::::::::::::::::::::::::::::::::::: [warn] :: play#sbt-plugin;2.1.0: not found [warn] :::::::::::::::::::::::::::::::::::::::::::::: I did not find a resolver for this library, otherwise