playframework-2.4

How can I run JUNITs in Eclipse when there is a dependency of EBean enhancing models?

六月ゝ 毕业季﹏ 提交于 2019-12-12 04:07:34
问题 I'm trying to execute junits in a project where the stack is playframework with java, I'm able to run the test by calling sbt test but I would like run the junits in eclipse IDE but keeps showing errors because the models are NOT enhanced. I saw that there is a plugin for eclipse, but it didn't work for me. Do you guys know to do accomplish running that junits in eclipse? As a not I'm a noobie using playframework. Thanks in advance. 回答1: After doing more research, I found that there are two

how to enhance ebean models in a jar

烈酒焚心 提交于 2019-12-11 20:04:05
问题 i have this requirement to factor out the ebean models of a project so they can be reused by other play projects. i thought about creating a subproject containing only the models, but then that means i have to duplicate the subproject in every project that depends on it which isn't DRY enough to me. so then i created a jar of the subproject using publishLocal so the main project now just includes it like any other library in the build.sbt file. everything compiles well but when i run the main

error after upgrade to play 2.4 from play2.3

落爺英雄遲暮 提交于 2019-12-11 17:58:32
问题 After making the following change to upgrade from play framework 2.3 to play 2.4: addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.4.3") as well for the sbt version: sbt.version=0.13.8 I got the following error: trace] Stack trace suppressed: run last myProject-app-server/compile:playRoutes for the full output. [error] (myProject-app-server/compile:playRoutes) java.lang.NoSuchMethodError: play.routes.compiler.inject.twirl.forwardsRouter_Scope0$forwardsRouter._display_(Ljava/lang/Object

Play framework2.4 can not add key store value to .scala build sbt file

时光毁灭记忆、已成空白 提交于 2019-12-11 15:29:55
问题 I'am trying to upgrade to play framework 2.4 from play 2.3, but when refreshing SBT I got the following error: build/*:resourceDirectory from build/*:privateKeystore ((project.Build).scala:10) [error] Did you mean build/compile:resourceDirectory I'am using .scala file as SBT build file play 2.3: which used to be working well privateKeystore := confDirectory.value / "myProject.private.jks" play 2.4: the change that caused the error privateKeystore := resourceDirectory.value / "myProject

Play 2.4.x - Assets duplication

穿精又带淫゛_ 提交于 2019-12-11 13:58:09
问题 In a Play 2.4.6 app I'm working on the assets are being duplicated in stage/dist tasks. Basically it is a app with 3 submodules, with all the assets present in the main public folder. I don't have sbt-web enabled and have no webjars dependencies (but from the jar contents Play may be using them somewhere). If I use PlayKeys.externalizeResources := false I end up with two jar files in the lib folder: myapp-server.myapp-server-0.9.6-assets.jar myapp-server.myapp-server-0.9.6.jar The first one

Anorm: WHERE condition, conditionally

狂风中的少年 提交于 2019-12-11 10:18:53
问题 Consider a repository/DAO method like this, which works great: def countReports(customerId: Long, createdSince: ZonedDateTime) = DB.withConnection { implicit c => SQL"""SELECT COUNT(*) FROM report WHERE customer_id = $customerId AND created >= $createdSince """.as(scalar[Int].single) } But what if the method is defined with optional parameters : def countReports(customerId: Option[Long], createdSince: Option[ZonedDateTime]) Point being, if either optional argument is present, use it in

Force Play (Scala) Json Composite Validators to Fail on First Failed Validator

半腔热情 提交于 2019-12-11 03:45:43
问题 I'm writing a custom validator for json objects. The default method is to create a case class T and an implicit reader of type Reads[T] . This is what my code looks like (I've created a simple "always fail" validator for the first json attribute just to illustrate my point). (The second validator looks a bit different because I also need "id" to validate the "body" attribute, but I want to have it only run if the first one succeeds). case class ExecuteQueryModel(datasourceId: Long, body:

ClassCastException in ModelMapper: EnhancerByModelMapper cannot be cast

假装没事ソ 提交于 2019-12-11 03:44:02
问题 I'm using ModelMapper 0.7.4 (latest version) in a Play 2.4.2 (latest version) framework application. Play 2.4 has an internal Google Guice dependency injection solution build into it, and our application is a manually bridged from Guice to a Spring Framework dependency injection solution, to get Play 2.4 to work with Spring. So communication flows from Play to Guice to Spring. Things (dependency injection with Spring) seem to work fine, but when a random Java class is changed in the test

how plugin works with inject and object instead of class in play 2.4

依然范特西╮ 提交于 2019-12-11 03:08:08
问题 I need to migrate the play mailer plugin for play 2.4.I checked some samples for play 2.4 and found that all the samples uses classes for plugin. I don't want to convert it to class. Is there any way for it to work with Object? Sample class MyComponent @Inject() (mailerClient: MailerClient) { def sendEmail { val email = Email(......) ...... mailerClient.send(email) } } Original Code object MailHandler{ def sendEmail(to: String) = { try { val email = play.api.libs.mailer.Email(...)

PlayFramework 2.4 and IntelliJ 14

梦想的初衷 提交于 2019-12-11 02:42:38
问题 I'm trying to import a PlayFramework 2.4 project into IntelliJ 14.1.3. I failed to import existing one (created in pre-2.4), so made these steps: Created a new play-java project via activator: activator new appName Tried to open the created project via IntelliJ. (Opened the Open dialog, then selected the folder with my app, then set JDK to 1.8.0_45) I'm getting this exception: Error while importing SBT project: ... at scala.collection.mutable.WrappedArray.foreach(WrappedArray.scala:34) at