Skip to content

Instantly share code, notes, and snippets.

Created January 30, 2013 14:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/b1572e80d2e6a40ee1e7 to your computer and use it in GitHub Desktop.
Save anonymous/b1572e80d2e6a40ee1e7 to your computer and use it in GitHub Desktop.
how to DRY
task warInt (type: War) {
def env = 'int'
baseName = 'MYAPP'
version += "-$env"
include("**/log4j_${env}.conf", "**/web_${env}.xml", '**/templates/**')
rename("log4j_${env}.conf", 'log4j.conf')
rename("web_${env}.xml", 'web.xml')
}
task warProd (type: War) {
def env = 'prod'
baseName = 'MYAPP'
version += "-$env"
include("**/log4j_${env}.conf", "**/web_${env}.xml", '**/templates/**')
rename("log4j_${env}.conf", 'log4j.conf')
rename("web_${env}.xml", 'web.xml')
}
task warTest (type: War) {
def env = 'test'
baseName = 'MYAPP'
version += "-$env"
include("**/log4j_${env}.conf", "**/web_${env}.xml", '**/templates/**')
rename("log4j_${env}.conf", 'log4j.conf')
rename("web_${env}.xml", 'web.xml')
}
task warLocal (type: War) {
def env = 'local'
baseName = 'MYAPP'
version += "-$env"
include("**/log4j_${env}.conf", "**/web_${env}.xml", '**/templates/**')
rename("log4j_${env}.conf", 'log4j.conf')
rename("web_${env}.xml", 'web.xml')
}
task warAll(dependsOn: [warInt, warProd, warTest]) {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment