I have build.gradle
file:
...
jar {
baseName 'dev-filename'
manifest {
attributes (
'Class-Path': configurations.runtime.collect {it.getName() }.join(' ')
'Main-Class': 'package.of.main.class'
)
}
}
...
And properties file src/main/resources/application.properties
:
...
database.username=dev_user
database.password=dev_password
...
How to create tasks (dev and prod) to build jar file and update values in the property file?
UPD1: I've tried next, but it doesn't work:
...
jar {
baseName 'dev-filename'
manifest {
attributes (
'Class-Path': configurations.runtime.collect {it.getName() }.join(' ')
'Main-Class': 'package.of.main.class'
)
}
ant.propertyfile(file: 'application.properties') {
entry(key: 'database.username', value: 'new_username')
entry(key: 'database.password', value: 'new_password')
}
}
...