OSX Play框架自动重新加载 [英] OSX Play Framework Auto-Reload

查看:94
本文介绍了OSX Play框架自动重新加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经搜寻互联网好几个小时了,有很多有用的"建议……除了问题之外什么也没有.

I've been scouring the internet for hours now, there is lots of "helpful" advice...that cause nothing but problems.

这就是我,几乎完全是

在Docker容器中自动加载框架

我正在运行Play的最新版本(我想,不知道如何检查,但下载了<一周前)!具有Java 8的ubuntu docker容器内部的框架,使用以下dockerfile构建:

I'm running the latest (I think, don't know how to check but downloaded < a week ago) version of the Play! 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

多个 来源显示相同或相似的问题,并且或多或少地得出相同的结论.我将按照以下方式启动我的游戏应用程序:

Multiple sources across the internet show the same or similar issues, and more or less arrive at the same conclusion. I'm starting my play application as follows:

我将不重复上面链接的内容,这基本上是相同的情况. (虽然网页未反映更改,但检测到文件更改,它正在显示一个编译.)此外,我通过反编译生成的.class文件来验证正确的编译,它显示了正确的代码.

I'm not going to repeat what's linked above, it's basically an identical situation. (The file changes are detected, it's showing a compile, though webpage doesn't reflect changes.) Further, I'm verifying a correct compile by decompiling the generated .class files, it's showing the correct code.

现在,当我说出神奇的话时:将以下行添加到我的build.sbt文件中

Now, when I say the magic words: Adding the following line to my build.sbt file

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

我的总体build.sbt是:

I get an overall build.sbt of:

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)

在项目目录中运行./activator会导致它重新评估我的构建文件并生成以下内容:

Running ./activator in my project directory causes it to reevaluate my build file and generate 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

显而易见,一刀切"的解决方案不再适用.从那以后我一直很沮丧.我发现从2.3.x版本开始,对于该命令无效的任何更改绝对没有任何注意.取而代之的是,我看到事情提到了我在2.3.2之后工作".

As is apparent, the one-size-fits-all solution is no longer applicable. I've been stumped since. I've found absolutely no notice of any changes since 2.3.x that would make this command invalid. Instead, I see things mentioning "works after 2.3.2", which I am.

PS:

任何人都可以解释链接文章末尾描述的Ctrl-D奇怪行为.考虑到Ctrl-D应该退出的事实,我也遇到了同样的情况,这似乎很奇怪.

Can anyone explain the odd Ctrl-D behavior described at the end of the linked post. I'm experiencing the same, seems very odd considering the fact that Ctrl-D is supposed to exit...

推荐答案

好吧,更多的互联网搜索,我终于崩溃了,开始玩Play! github框架找到他们的测试build.sbt,恰好是使用 new 选项.

Ok, more internet scouring, and I finally broke down and dug through the Play! Framework github to find their test built.sbt, which happened to be using the new option.

显然,在迁移指南中深深地注意到了这一点. (花了我一段时间才可以追溯到它.)

Apparently, buried deep in the migration guide this was noted. (Took me a while to retrospectively find it.)

很明显,我的错误是基于2.3.2+中包含2.4.0的假设,而没有检查隐秘的文档(以我的拙见).对于其他遇到类似情况而绊脚石的人,不要再犹豫了:

My mistake, apparently, lied in the assumption that 2.4.0 was included in 2.3.2+, without checking the well-hidden (in my humble opinion) documentation. For anyone else who comes stumbling along with a similar situation, look no further:

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

这是从 2.4.0 开始播放轮询的新语法.检查迁移报告到您使用的版本,如果这导致另一个错误,请查看他们是否再次更改了它.

This is the new syntax for the play polling, as of 2.4.0. Check the migration reports up to the version you are using if this causes another error to see if they've changed it again.

我只是想知道,我为发泄某种This is Deprecated消息而不是仅仅盲目谴责我所做的一切而感到疯狂吗?似乎将来会增加一些好处.

Just wondering, am I crazy to have expected some sort of This is Deprecated message to be spit out instead of just blind condemnation of all that I've done? That seems like something that would be good to add for the future.

这篇关于OSX Play框架自动重新加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆