Skip to content

Instantly share code, notes, and snippets.

@neversleepz
Created August 26, 2014 18:34
Show Gist options
  • Save neversleepz/10a8b293197a3ee643da to your computer and use it in GitHub Desktop.
Save neversleepz/10a8b293197a3ee643da to your computer and use it in GitHub Desktop.
Inplace html files that swap out version numbers but still allow gradle to keep up to date checks
apply plugin: 'java'
apply plugin: 'jetty'
sourceCompatibility = 1.8
version = '1.0'
repositories {
mavenCentral()
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.11'
}
war {
expand([version: version])
duplicatesStrategy DuplicatesStrategy.FAIL
}
task warList(dependsOn: war) << {
def tree= zipTree(war.archivePath);
tree.each { println it; if (it.name == 'index.html') { println it.toPath().readLines().toString() } }
}
@neversleepz
Copy link
Author

to be specific about which files are expanded you can use

with {
    from('index.html')
    expand([version: version])
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment