title: How to specify spring.profiles.active when I run mvn install
body: <p>In this web application with Spring, I created several application-property files for different deploy environment. They specify different db connection configs. </p>
  
  <pre><code>application-dev.properties
  application-qa.properties
  application-stg.properties
  application-prod.properties
  </code></pre>
  
  <p>The recommended way according to <a href="http://docs.spring.io/spring-boot/docs/current/reference/html/howto-properties-and-configuration.html" rel="noreferrer">spring doc</a> is to set spring.profiles.active as JVM option at run time, for example:</p>
  
  <pre><code>-Dspring.profiles.active=prod
  </code></pre>
  
  <p>However what should I do for deploying the application as war using mvn install. How should I set the spring profile? I am using Eclipse.</p>
  
  <p><strong>EDIT</strong>:
  I set the JVM option under <a href="https://i.stack.imgur.com/uNqpj.png" rel="noreferrer"><img src="https://i.stack.imgur.com/uNqpj.png" alt="run configuration"></a>. It does not seem to get picked up by maven when I deploy it as a war though since I got the following error from tomcat:</p>
  
  <pre><code>Failed to instantiate [javax.sql.DataSource]: Factory method 'dataSource' threw exception
  </code></pre>