title: Project running for mvn test but not running for mvn test -P<<profile_name>>
body: <p>I have gone through lot of articles and SO posts before posting this question. I have created 2 maven profiles, one for each environment. When I run my pom.xml through eclipse's Run As > Maven test, the tests are executed. But when I execute it through Run Configuration, for this purpose, I created a Run Configuration called "Test Project" which has maven goals set to "test" and profiles set to "staging", the execution is throwing </p>
  
  <blockquote>
    <p>There was an error in the forked process
    [ERROR] com/beust/jcommander/ParameterException : Unsupported major.minor version 52.0
    [ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: There was an error in the forked process
    [ERROR] com/beust/jcommander/ParameterException : Unsupported major.minor version 52.0</p>
  </blockquote>
  
  <p>If it's a java version issue, then it shouldn't have executed when I executed Run As > Maven test. </p>
  
  <p>Here's my pom.xml</p>
  
  <p>http://maven.apache.org/xsd/maven-4.0.0.xsd">
      4.0.0</p>
  
  <pre><code>&lt;groupId&gt;com.sample&lt;/groupId&gt;
  &lt;artifactId&gt;TestProject&lt;/artifactId&gt;
  &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
  &lt;packaging&gt;jar&lt;/packaging&gt;
  
  &lt;name&gt;TestProject&lt;/name&gt;
  &lt;url&gt;http://maven.apache.org&lt;/url&gt;
  
  &lt;properties&gt;
      &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
  &lt;/properties&gt;
  
  &lt;profiles&gt;
      &lt;profile&gt;
          &lt;id&gt;staging&lt;/id&gt;
          &lt;build&gt;
              &lt;plugins&gt;
                  &lt;plugin&gt;
                      &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                      &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
                      &lt;version&gt;2.20&lt;/version&gt;
                      &lt;configuration&gt;
                          &lt;suiteXmlFiles&gt;
                              &lt;suiteXmlFile&gt;testng.xml&lt;/suiteXmlFile&gt;
                          &lt;/suiteXmlFiles&gt;
                      &lt;/configuration&gt;
                  &lt;/plugin&gt;
              &lt;/plugins&gt;
          &lt;/build&gt;
      &lt;/profile&gt;
  
      &lt;profile&gt;
          &lt;id&gt;prod&lt;/id&gt;
          &lt;build&gt;
              &lt;plugins&gt;
                  &lt;plugin&gt;
                      &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                      &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
                      &lt;version&gt;2.20&lt;/version&gt;
                      &lt;configuration&gt;
                          &lt;suiteXmlFiles&gt;
                              &lt;suiteXmlFile&gt;testng2.xml&lt;/suiteXmlFile&gt;
                          &lt;/suiteXmlFiles&gt;
                      &lt;/configuration&gt;
                  &lt;/plugin&gt;
              &lt;/plugins&gt;
          &lt;/build&gt;
      &lt;/profile&gt;
  &lt;/profiles&gt;
  
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.testng&lt;/groupId&gt;
          &lt;artifactId&gt;testng&lt;/artifactId&gt;
          &lt;version&gt;6.11&lt;/version&gt;
      &lt;/dependency&gt;
  
  
      &lt;!-- https://mvnrepository.com/artifact/org.uncommons/reportng --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.uncommons&lt;/groupId&gt;
          &lt;artifactId&gt;reportng&lt;/artifactId&gt;
          &lt;version&gt;1.1.4&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
          &lt;exclusions&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;org.testng&lt;/groupId&gt;
                  &lt;artifactId&gt;testng&lt;/artifactId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
  
  &lt;/dependencies&gt;
  </code></pre>
  
  <p></p>
  
  <p>Both testng.xml and testng2.xml are similar except for the parameter value.
  Here's my testng.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"&gt;
  &lt;suite verbose="0" name="Test Project suite"&gt;
       &lt;parameter name="env" value="staging" /&gt; 
      &lt;test name="Test Project sample tests"&gt;
          &lt;classes&gt;
              &lt;class name="com.sample.TestProject.AppTest" /&gt;
          &lt;/classes&gt;
      &lt;/test&gt;
  &lt;/suite&gt; 
  </code></pre>