I have a Spring Boot Web Application which I need to deploy to Tomcat using Jenkins.
I have setup the pipeline and the deployment happens just fine.
But, I have two profiles in my application. One for development and the other for production. Some properties like the DB URLs etc are different for each of these profiles.
So, I have two property files inside src/main/resources
as follows:
application-dev.properties
application-prod.properties
Also, I have another application.properties
in the same directory which has only one property (that of the active profile)
spring.profiles.active=dev
Now when I run this through Eclipse, things work pretty fine. Even when Jenkins deploys the WAR to tomcat, everything is good, except for one issue. I am unable to change the value of spring.profiles.active
to prod
before the deployment to Tomcat happens.
Currently, my SVN has the application.properties
file committed with spring.profiles.active = prod
When someone checks out the code and are working in their local environments, they change it to "dev" and continue working, and they just don't commit this change to the SVN. This is temporary workaround I follow, and I feel this can be done in a more efficient way.
How do I have the same WAR file and just change the profile without having to modify my application.properties file? Can this be done in Jenkins? Or should I look at someplace else??
Thanks, Sriram Sridharan