title: How to build war with a selected profile in maven from command line
body: <p>We have a Spring based project that we are using for creating a REST Server. It is maven controlled and has profiles pointing to different servers as and when required. I need a mechanism so that I can build war files on the runtime using command line. </p>
  
  <p>Sample Profile tags </p>
  
  <pre><code>    &lt;profiles&gt;
      &lt;profile&gt;
          &lt;id&gt;qa&lt;/id&gt;
          &lt;properties&gt;
              &lt;run.scheduledjob&gt;YES&lt;/run.scheduledjob&gt;
              &lt;logfile.location&gt;/var/lib/tomcat7/logs&lt;/logfile.location&gt;
              &lt;imagefile.location&gt;/tmp/tmpImages&lt;/imagefile.location&gt;
              &lt;elasticsearch.host&gt;{elastic-sample}&lt;/elasticsearch.host&gt;
              &lt;db.username&gt;{username}&lt;/db.username&gt;
              &lt;db.url&gt;{url}&lt;/db.url&gt;
              &lt;db.password&gt;{password}&lt;/db.password&gt;
          &lt;/properties&gt;
      &lt;/profile&gt;
      &lt;profile&gt;
          &lt;id&gt;development&lt;/id&gt;
          &lt;properties&gt;
              &lt;run.scheduledjob&gt;YES&lt;/run.scheduledjob&gt;
              &lt;logfile.location&gt;/var/lib/tomcat7/logs&lt;/logfile.location&gt;
              &lt;imagefile.location&gt;/tmp/tmpImages&lt;/imagefile.location&gt;
              &lt;elasticsearch.host&gt;{elastic-sample}&lt;/elasticsearch.host&gt;
              &lt;db.username&gt;{username}&lt;/db.username&gt;
              &lt;db.url&gt;{url}&lt;/db.url&gt;
              &lt;db.password&gt;{password}&lt;/db.password&gt;
          &lt;/properties&gt;
      &lt;/profile&gt;
  &lt;/profiles&gt;
  </code></pre>
  
  <p>I need to select qa or development at runtime using maven command line switch,
  I tried <code>mvn clean install -Pqa</code> or <code>mvn clean install -Pdevelopment</code> but was not able to evaluate was the profile actually activated. </p>
  
  <p>Can someone help out?</p>