java - Gradle build multiple .war files with different properties file -
we developing new web application scratch using spring boot , relevant dependencies , built using gradle.
our project has 5 stages of testing, each stage executing on different server , end different configuration on each server.
the above scenario common situation , practice followed in earlier projects save "properties" file directly under server's classpath same .war file can deployed on multiple servers , still have different configuration based on server/environment.
now, obvious disadvantage above setup - such setup cannot shared other developers through version controller. , further cant use power of "process resources" task in gradle introduce dynamic properties during build process.
now, if pull .properties file within project setup, can version control it, sharing becomes easier , can introduce dynamic properties through gradle. disadvantage being might have prepare multiple .war files after updating .properties file.
there 2 questions have?
- what thought on above 2 ways? given situation choose , why (any other way of dealing scenario)?
- in 2nd case of building multiple .war files, how re-run war task generate new output file?
thanks!
you should build 1 war environments. set os envvar per environment (ex spring.profile=dev, spring.profile=prod).
read right property file based on envvar(spring you). ex application-dev.properties, application-prod.properties
store production db connection passwords in envvars while you're @ it.
see
http://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html
Comments
Post a Comment