Dynamically generate a configuration which can be loaded by `./gradlew run`
This commit is contained in:
parent
ac6907c5f1
commit
13dc8672cf
17
build.gradle
17
build.gradle
|
@ -36,3 +36,20 @@ dependencies {
|
|||
// 'test.useTestNG()' to your build script.
|
||||
testCompile 'junit:junit:4.12'
|
||||
}
|
||||
|
||||
task generateExampleYaml {
|
||||
def outputFile = "${buildDir}/httpwizard.example.yml"
|
||||
group 'Build'
|
||||
description "Generate ${outputFile} for running the app"
|
||||
doLast {
|
||||
file(outputFile).text = """---
|
||||
appVersion: "${project.version}-${grgit.head().abbreviatedId}"
|
||||
"""
|
||||
}
|
||||
outputs.file file(outputFile)
|
||||
}
|
||||
|
||||
run {
|
||||
args 'server', "${buildDir}/httpwizard.example.yml"
|
||||
dependsOn generateExampleYaml
|
||||
}
|
||||
|
|
|
@ -28,5 +28,5 @@ import org.hibernate.validator.constraints.NotEmpty
|
|||
*/
|
||||
class HttpWizardConfiguration extends Configuration {
|
||||
@NotEmpty
|
||||
private String appVersion
|
||||
String appVersion
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue