FAQ Database Discussion Community


Play Framework @routes.Assets.at Compilation Error

java,playframework,java-8,playframework-2.4
I'm using Play 2.4.0 and I've been trying to follow the tutorial from the main page: https://playframework.com/ which is for Play 2.3 and after solving a couple of issues regarding changes in the Ebean ORM from version 2.3 to 2.4, I'm stuck with the following error: Compilation error value at...

How to use RequireJS optimizer in Play framework?

requirejs,webjars,requirejs-optimizer,playframework-2.4
As advertised, the rjs in Play can ensure that any JavaScript resources referenced from within a WebJar are automatically referenced from the jsdelivr CDN. In addition if any .min.js file is found then that will be used in place of .js. An added bonus here is that there is no...

How to use `controllers.Default.redirect` in Play 2.4 and `InjectedRoutesGenerator`

scala,playframework,playframework-2.4
If I try to use controllers.Default.redirect(to = "/foo/bar") in my routes file with routesGenerator := InjectedRoutesGenerator enabled in my build.sbt file, I get the compilation error type Default is not a member of package controllers With this new injected routes feature in Play 2.4 is there still a way to...

Error running tests in Play Framework after migrating to 2.4.x (Java)

java,playframework,guice,webjars,playframework-2.4
I just migrated from 2.3 to 2.4. The application itself seems to be working, but none of the tests will run. They all fail with the following error: [error] Test models.TestCountry.createTheater failed: com.google.inject.ProvisionException: Unable to provision, see the following errors: [error] [error] 1) Error injecting constructor, java.lang.IllegalStateException: Got deeper than...

play-slick 1.0.0: Cannot define column with type of java.sql.Date

playframework,slick,play-slick,slick-3.0,playframework-2.4
I'm currently trying to define a slick schema as follows using play-framework 2.4.0-RC5 together with play-slick 1.0.0-RC3: import java.sql.Date import play.api.Play import play.api.db.slick.{DatabaseConfigProvider, HasDatabaseConfig} import slick.profile.RelationalProfile class Dao extends HasDatabaseConfig[RelationalProfile] { protected val dbConfig = DatabaseConfigProvider.get[RelationalProfile](Play.current) import driver.api._ private class Tab(tag: Tag) extends Table[(Int, Date)](tag, "tab") { def id =...

PlayFramework 2.4 and IntelliJ 14

java,scala,intellij-idea,playframework-2.4
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...

Play upgrade to 2.4 but failed to fetch sbt-plugin

playframework-2.3,playframework-2.4
[warn] :::::::::::::::::::::::::::::::::::::::::::::: [warn] :: UNRESOLVED DEPENDENCIES :: [warn] :::::::::::::::::::::::::::::::::::::::::::::: [warn] :: com.typesafe.play#sbt-plugin;2.4.0: not found [warn] :::::::::::::::::::::::::::::::::::::::::::::: [warn] [warn] Note: Some unresolved dependencies have extra attributes. Check that these dependencies exist with the requested attributes. [warn] com.typesafe.play:sbt-plugin:2.4.0 (scalaVersion=2.10, sbtVersion=0.13) This is my plugins.sbt: resolvers ++= Seq( "Typesafe Releases" at...

Play Framework Form Error Handling

scala,playframework,playframework-2.3,playframework-2.4
This is my view file containing the form that has to filled in by the user: @helper.form(call) { @helper.input(resumeForm("surname"), '_label -> "Surname") { (id, name, value, args) => <input name="@name" type="text" value="@value" placeholder="Enter your surname"> } } This is my custom field constructor: @(elements: helper.FieldElements) @if(!elements.args.isDefinedAt('showLabel) || elements.args('showLabel) == true)...

How to inject something into a form

java,playframework,playframework-2.4
Since play 2.4.0, we can use a DI framework. I am trying to use DI in my app. I moved my jpa finders from static methods on my models classes to methods in a service layer that I inject into my controllers. My main problem is that I have some...

How to do database initialization when using DI in Play 2.4?

scala,playframework,dependency-injection,playframework-2.4
Play 2.4 discourages using GlobalSettings.onStart and whole Global object. I'm using play-slick and it has great DI sample in GitHub, but it is missing a example how to do database initialization. How does one implement the database initialization when using DI and when GlobalSettings.onStart is not available? Common cases for...

How to make JsHint sbt plugin more useful?

jshint,sbt-plugin,playframework-2.4
When I have jshint sbt plugin enable in my Play project, I get these annoying errors which are really not errors. How can I turn them off, or avoid them? Thanks ...

How to use a path relative to project root to H2 db-file configuration with Play Framework 2.4?

jdbc,h2,relative-path,persistent,playframework-2.4
We're developing a Play 2.4 application (Java API). For dev purposes, we'd like to use a persistent H2 database with DB file path relative to the project root directory. In How to use a persistent H2 database in the Play Framework instead of in-memory there was solution for Play 2.0:...

Play cannot resolve MySQL Driver

java,playframework,sbt,playframework-2.4
I just upgraded to Play 2.4 and for whatever reason I'm unable to load up the JDBC MySQL driver. Here is what I have in build.sbt libraryDependencies ++= Seq( javaJdbc, cache, javaWs, "mysql" % "mysql-connector-java" % "5.1.+", evolutions ) After refreshing (IntelliJ) and running the application, I still receive the...

Play Framework 2.4 @routes.WebJarAssets.at Compilation Error in IntelliJ IDEA 14.1.3

scala,intellij-idea,playframework,intellij-idea-14,playframework-2.4
I'm trying to use WebJars with Play Framework 2.4.0, in Intellij IDEA 14.1.3. I have SBT 1.7.0 plugin and Scala 1.5.2 plugin (with project Scala version 2.11.6). My application works well when I run it from the terminal ($ activator run or $ sbt run) but I have compilation error...

Playframework 2.4 Singletons, Object

playframework-2.4
Before Playframework 2.4 I used create object for singleton class, and now I see than Singletons can be achieved using the @Singleton annotation. But, what is the difference? Is only for using a dependency injection with @Inject() ? I am afraid that Playframework 2.4 with dependency Injection enter in an...

SBT is wasting lots of disk space for dependencies each build

jenkins,sbt,playframework-2.4
We have a Playframework 2.4 (with SBT 0.13.8) project which we build on a Jenkins. Today, the Jenkins stopped working because his $JENKINS_HOME run full. I analyzed which tool was wasting the disk space: SBT. There is a folder located at .sbt/0.13/dependency/module/dynamic that contains quadrillions of subfolders. Each of these...

How to add user library as dependency to play framework?

java,sbt,pubnub,playframework-2.4
I am trying to add user library to the project, but while running application showing the following errors. (may be it should be added to sbt files somehow)?/home/thrymr/workspace/androidBackendWorkspace/RideBackend/app/pubnub/Publisher.java:7: package com.pubnub.api does not exist [error] com.pubnub.api.Callback [error] trying to add pubnub jars file....

Play Framework 2.4 IDE Eclipse directions don't work

eclipse,playframework,sbt,playframework-2.4
The directions can be found here: If I try and do activator eclipse I get an error that eclipse isn't a command. Specifically: "[error] Not a valid command: eclipse" If I I add addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "4.0.0") to plugins.sbt it gives an error....