OSX Play Framework Auto-Reload

I've been cleaning the internet for hours, there are many "useful" tips ... which cause nothing but problems.

This is me, almost exactly:

Load the auto-loading framework into a docker container

I'm using the latest (I don't know how to check, but I downloaded it a week ago) version of the game! Framework inside a ubuntu docker container with Java 8, built with the following dockerfile:

FROM ubuntu:latest
MAINTAINER [REDACTED]
RUN sudo apt-get update
RUN sudo apt-get -y install software-properties-common
RUN sudo apt-add-repository ppa:webupd8team/java
RUN sudo apt-get update
RUN echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections
RUN sudo apt-get -y install oracle-java8-installer
RUN java -version

      

Several sources on the Internet show the same or similar problems, and more or less come to the same conclusion . I run my game app like this:

I will not repeat what was linked above, it is basically an identical situation. (File changes were detected, it shows compilation, although the webpage does not reflect the changes.) Also, I check the correct compiler by decompiling the generated .class files, displaying the correct code.

Now when I say the magic words: by adding the following line to build.sbt file

PlayKeys.playWatchService := play.sbtplugin.run.PlayWatchService.sbt(pollInterval.value)

      

I am getting a generic build.sbt file:

name := """cms-work"""

version := "1.0-SNAPSHOT"

retrieveManaged := true

lazy val root = (project in file(".")).enablePlugins(PlayJava)

scalaVersion := "2.11.6"

libraryDependencies ++= Seq(
  javaJdbc,
  cache,
  javaWs
)

// Play provides two styles of routers, one expects its actions to be injected, the
// other, legacy style, accesses its actions statically.
routesGenerator := InjectedRoutesGenerator

// Polling for auto-reload, because networked filesystem.
PlayKeys.playWatchService := play.sbtplugin.run.PlayWatchService.sbt(pollInterval.value)

      

Running ./activator

in my project directory forces it to reevaluate my build file and create the following:

/root/cms-work/build.sbt:23: error: value playWatchService is not a member of object play.sbt.Play.autoImport.PlayKeys
PlayKeys.playWatchService := play.sbtplugin.run.PlayWatchService.sbt(pollInterval.value)
         ^
[error] Type error in expression

      

As you can see, a solution of one size fits all is no longer applicable. Since then, I've been at a dead end. I found absolutely no notice of any changes from 2.3.x that would invalidate this command. Instead, I see things that mention "works after 2.3.2" that I am.

PS:

Can anyone explain the odd Ctrl-D behavior described at the end of the linked post. I am experiencing the same thing, it seems very strange considering the fact that Ctrl-D should exit ...

+3


source to share


2 answers


Ok, more internet cleaning and I finally broke and dug the game! Framework github to find your test built.sbt which used the new option.

Apparently this was seen deeply in the migration guide. (It took me a while to retrospectively find it.)

My mistake apparently was in assuming 2.4.0 was included in 2.3.2+ without checking the well hidden (in my humble opinion) documentation. For those who come across a similar situation, look no further:

PlayKeys.fileWatchService := play.sbtplugin.run.PlayWatchService.sbt(pollInterval.value)

      



This is the new syntax for game polling since 2.4.0 . Check the migration reports to the version you are using if it causes another error to see if they changed it again.


Just wondering am I out of my mind expecting some message to This is Deprecated

spit out and not just blindly judging everything I've done? It looks like something that would be nice to add to the future.

+1


source


error: value playWatchService is not a member of object play.sbt.Play.autoImport.PlayKeys

error: object sbtplugin is not a member of package play

      

In Playframework 2.4.X, the SBT install key has playWatchService

been renamed to fileWatchService

.

The corresponding class has also changed. To set fileWatchService

to poll every two seconds, use it like this:



scala PlayKeys.fileWatchService := play.runsupport.FileWatchService.sbt(2000)

      

Extracted from: https://www.playframework.com/documentation/2.4.x/Migration24#playWatchService-renamed

+1


source







All Articles