title: Spring Boot Jenkins CD/CI Change profile before deployment
body: <p>I have a Spring Boot Web Application which I need to deploy to Tomcat using Jenkins.</p>
  
  <p>I have setup the pipeline and the deployment happens just fine.</p>
  
  <p>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.</p>
  
  <p>So, I have two property files inside <code>src/main/resources</code> as follows:</p>
  
  <pre><code>application-dev.properties
  application-prod.properties
  </code></pre>
  
  <p>Also, I have another <code>application.properties</code> in the same directory which has only one property (that of the active profile)</p>
  
  <pre><code>spring.profiles.active=dev
  </code></pre>
  
  <p>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 <code>spring.profiles.active</code> to <code>prod</code> before the deployment to Tomcat happens.</p>
  
  <p>Currently, my SVN has the <code>application.properties</code> file committed with <code>spring.profiles.active = prod</code></p>
  
  <p>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.</p>
  
  <p>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??</p>
  
  <p>Thanks,
  Sriram Sridharan</p>