我有一个gradle项目。我想通过替换@ version @ token从gradle.properties向我的index.html添加版本控制。我尝试过以下方法:
build.properties
version=1.0.12 // i want this version
projectJdk=Oracle JDK 8
的build.gradle
import org.apache.tools.ant.filters.*
processResources {
println 'here1 '
filesMatching('static/index.html') {
filter(ReplaceTokens, tokens: [version: project.version])
println 'here2' + project.version //this is printed meaning file the exists
}
}
的index.html
<span class="col-lg-offset-5">@version@</span>
index.html位于 src / main / resources / static
下谢谢,