【发布时间】:2018-11-22 15:56:11
【问题描述】:
我是 Gradle 的新手(我们正在从 SBT 切换)并使用它来构建使用 Play Framework 制作的应用程序。
我需要在 Gradle 处理它们之前对资源添加一些过滤(我想将一些构建属性注入到配置中以使它们可从代码中使用)。
我已经设法“扩展”了 java processResources 任务,但由于某种原因,我不能对 play processPlayBinaryPlayResources 做同样的事情。
processPlayBinaryPlayResources {
filter ReplaceTokens, tokens: [
"applicationVersion": version
]
}
即使这样也行不通:
def playVersion = "2.6.20"
def scalaVersion = "2.12"
def javaVersion = "1.8"
apply plugin: "java"
apply plugin: "idea"
apply plugin: "play"
model {
components {
play {
platform play: playVersion, scala: scalaVersion, java: javaVersion
injectedRoutesGenerator = true
}
}
}
processPlayBinaryPlayResources {
doLast {
println("ok")
}
}
dependencies {
compile "io.vavr:vavr:0.9.2"
compile "org.imgscalr:imgscalr-lib:4.2"
compile "com.typesafe.play:play-guice_${scalaVersion}:2.6.20"
compile "com.typesafe.akka:akka-http_${scalaVersion}:10.1.5"
compile "com.typesafe.play:filters-helpers_${scalaVersion}:2.6.20"
compile "ch.qos.logback:logback-classic:1.2.3"
}
它产生:
> Could not find method processPlayBinaryPlayResources() for arguments [build_6grwx7eowye82rdqpu4qlinur$_run_closure2@582d9dbd] on root project 'myproject' of type org.gradle.api.Project.
知道为什么吗?
【问题讨论】: