Gradle:在index.html

时间:2017-05-04 09:27:41

标签: gradle build.gradle

我有一个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

谢谢,

0 个答案:

没有答案