title: Building multiple Maven profiles for a single Jenkins job
body: <p>I am trying to build multiple Maven profiles in a single Jenkins job.  Each profile changes some code and then creates a jar by executing <code>mvn -Pdev install</code> then <code>mvn -Pprod install</code> in the command line (According to Maven using <code>mvn -Pdev,prod install</code> is supposed to work but it isn't working for me).  Here are the two profiles in my project's <code>pom.xml</code>:</p>
  
  <pre><code>&lt;profiles&gt;   
   &lt;!-- prod profile --&gt;
     &lt;profile&gt;
      &lt;id&gt;prod&lt;/id&gt;
       &lt;build&gt;
        &lt;plugins&gt; 
  
            &lt;plugin&gt;
                  &lt;groupId&gt;com.google.code.maven-replacer-plugin&lt;/groupId&gt;
                  &lt;artifactId&gt;replacer&lt;/artifactId&gt;
                  &lt;version&gt;1.5.2&lt;/version&gt;
  
                  &lt;executions&gt;
                      &lt;execution&gt;                    
                          &lt;phase&gt;process-resources&lt;/phase&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;replace&lt;/goal&gt;
                          &lt;/goals&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
  
                  &lt;configuration&gt;
  
                           &lt;file&gt;src/main/java/com/IQzone/android/configuration/AbstractHoldingRefreshable.java&lt;/file&gt;
                      &lt;replacements&gt;
                          &lt;replacement&gt;
                              &lt;token&gt;TrUe&lt;/token&gt;
                              &lt;value&gt;TOAST_SWITCH&lt;/value&gt;
                          &lt;/replacement&gt;
                      &lt;/replacements&gt;
  
                  &lt;/configuration&gt;
  
              &lt;/plugin&gt;
  
           &lt;plugin&gt;
             &lt;artifactId&gt;maven-jar-plugin&lt;/artifactId&gt;
             &lt;executions&gt;
               &lt;execution&gt;
                 &lt;phase&gt;package&lt;/phase&gt;
                 &lt;goals&gt;
                   &lt;goal&gt;jar&lt;/goal&gt;
                 &lt;/goals&gt;
                 &lt;configuration&gt;
                   &lt;classifier&gt;prod&lt;/classifier&gt;
                 &lt;/configuration&gt;
               &lt;/execution&gt;
             &lt;/executions&gt;
           &lt;/plugin&gt;
         &lt;/plugins&gt;
       &lt;/build&gt;
     &lt;/profile&gt;
  
  
   &lt;!-- dev profile --&gt;
     &lt;profile&gt;
       &lt;id&gt;dev&lt;/id&gt;
       &lt;build&gt;
          &lt;plugins&gt;
  
              &lt;plugin&gt;
                  &lt;groupId&gt;com.google.code.maven-replacer-plugin&lt;/groupId&gt;
                  &lt;artifactId&gt;replacer&lt;/artifactId&gt;
                  &lt;version&gt;1.5.2&lt;/version&gt;
  
                  &lt;executions&gt;
                      &lt;execution&gt;                    
                          &lt;phase&gt;process-resources&lt;/phase&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;replace&lt;/goal&gt;
                          &lt;/goals&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
  
                  &lt;configuration&gt;
  
                      &lt;file&gt;src/main/java/com/IQzone/android/configuration/AbstractHoldingRefreshable.java&lt;/file&gt;
                      &lt;replacements&gt;
                          &lt;replacement&gt;
                              &lt;token&gt;TOAST_SWITCH&lt;/token&gt;
                              &lt;value&gt;TrUe&lt;/value&gt;
                          &lt;/replacement&gt;
                      &lt;/replacements&gt;
  
                  &lt;/configuration&gt;
  
              &lt;/plugin&gt;
  
              &lt;!-- build project with JAVA 1.6 --&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;1.6&lt;/source&gt;
                      &lt;target&gt;1.6&lt;/target&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
  
  
           &lt;plugin&gt;
             &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
             &lt;configuration&gt;
               &lt;skip&gt;true&lt;/skip&gt;
             &lt;/configuration&gt;
           &lt;/plugin&gt;
           &lt;plugin&gt;
             &lt;artifactId&gt;maven-jar-plugin&lt;/artifactId&gt;
             &lt;executions&gt;
               &lt;execution&gt;
                 &lt;phase&gt;package&lt;/phase&gt;
                 &lt;goals&gt;
                   &lt;goal&gt;jar&lt;/goal&gt;
                 &lt;/goals&gt;
                 &lt;configuration&gt;
                   &lt;classifier&gt;dev&lt;/classifier&gt;
                 &lt;/configuration&gt;
               &lt;/execution&gt;
             &lt;/executions&gt;
           &lt;/plugin&gt;
  
  
  
         &lt;/plugins&gt;
       &lt;/build&gt;
     &lt;/profile&gt;
   &lt;/profiles&gt;
  </code></pre>
  
  <p>How would I setup Jenkins to automatically build both of these profiles for a single Jenkins job whenever the job is hit for a build?  And put both of these jars in the Artifactory?  I have very little Jenkins knowledge and there isn't much information on this on the web.</p>