Jaa*_*aap 5 scala sbt playframework
我正在使用OTHER_HOME环境变量指向不同的SBT项目目录.我将把外部目录放在maven存储库中或通过github.com #tag项目引用,但是现在我想将一个基于文件的依赖项添加到Play项目中.
我的Build.scala风格是这样的:
val otherProjectDir = Option(System.getenv("OTHER_HOME"))
.getOrElse("Set environment OTHER_HOME to your 'other' git clone")
// take the core sublibrary from other project
val otherCore = ProjectRef(file(otherProjectDir), "core")
val main = play.Project(appName, appVersion, appDependencies)
.dependsOn(otherCore)
Run Code Online (Sandbox Code Playgroud)
我想切换到build.sbt,但我不知道如何做到这一点.请指教.
看起来 play 有一种方法来操纵他们的“监视服务”(监视文件的更改)。尝试添加此内容以build.sbt使重新加载等待一个小时(或您想要的任意时间):
PlayKeys.fileWatchService := play.runsupport.FileWatchService.sbt(3600000)
Run Code Online (Sandbox Code Playgroud)
请参阅此处:https ://www.playframework.com/documentation/2.4.x/Migration24#playWatchService-renamed
如果您想完全禁用它,您应该能够创建自己的 a 实例FileWatchService并设置上面的密钥以使用您的自定义观察程序(并使您的服务不执行任何操作)。就像是:
PlayKeys.fileWatchService := new FileWatchService {
def watch(filesToWatch: Seq[File], onChange: () => Unit): FileWatcher =
new FileWatcher {
def stop(): Unit = ()
}
}
Run Code Online (Sandbox Code Playgroud)
请注意,我尚未测试此代码片段,但您可以查看FileWatchService此处的源代码以供参考: https: //github.com/playframework/playframework/blob/master/framework/src/run-support/src/main/ scala/play/runsupport/FileWatchService.scala#L23
| 归档时间: |
|
| 查看次数: |
706 次 |
| 最近记录: |