Play Framework sbt-web integration without game plugin

Embedding as a library , I turned on the sbt-web plugin in my project and launched web-stage , making the assets copied verbatim to target/web/stage/ . However, using the Play Framework DSL line interpolation routing as follows, they are not serviced when a compliance request arrives:

 object PlayServer extends App { val server = NettyServer.fromRouter() { case GET(p"/public/$file*") => { val path = "/target/web/stage" Assets.at(path = path, file = file) } } 

Debugging through the replay code processing Assets.at , it seems that nothing leads to the fact that the assets become resources in target/scala-2.11/classes/ , where they supposedly play the framework trying to load them as resources. Running sbt web-stage does not concern this.

So, what is not enough to manage sbt-web to take care of placing assets there? When manual installation is there, integration works !! therefore it seems that sbt-web in its default configuration puts assets in the wrong target subdirectory as far as Play is concerned ...

Please note that in plugins.sbt I only include the following from sbt-web, should it be enough?

 addSbtPlugin("com.typesafe.sbt" % "sbt-web" % "latest.release") 
0
source share
1 answer

Placing assets under /src/main/resources/assets/ causes them to be copied to target at startup, bypassing any fancy sbt-web processing. This pushes you out of the mud for the base developer.

The route should be adapted as follows:

 case GET(p"/public/$file*") => { val path = "/assets" Assets.at(path = path, file = file) } 

Setting up the correct sbt-web pipeline to minimize or what ultimately cannot be fixed, so this is actually not the answer, but it solves a certain use case for using internal games.

0
source

All Articles