title: How to run specific Java class from POM.XML with reference to TestNG
body: <p>I do have Configuration of Maven + TestNG + Selenium + Java</p>
  
  <p><strong>I wants to run specific Java class from POM.XMl file,</strong> </p>
  
  <p><strong>Tried:</strong> </p>
  
  <pre><code>     &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
                  &lt;artifactId&gt;exec-maven-plugin&lt;/artifactId&gt;
                  &lt;version&gt;1.6.0&lt;/version&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;java&lt;/goal&gt;
                          &lt;/goals&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
                  &lt;configuration&gt;
                      &lt;mainClass&gt;demo.java&lt;/mainClass&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  </code></pre>
  
  <p>There is common solution provided as far I referred, But it did not worked. It didn't run anything and Build was success, </p>
  
  <p>Please note, As using TestNG there is not <code>public static void main(String args[])</code> in any of Java class. </p>
  
  <p>It would be great to have explanation on <code>&lt;mainClass&gt;demo.java&lt;/mainClass&gt;</code> part, With reference as TESTNG class. </p>
  
  <p><strong>So far I have tried :</strong></p>
  
  <p><a href="https://stackoverflow.com/questions/4060613/from-maven-how-do-i-run-a-class-that-lives-under-src-test-java">From Maven, how do I run a class that lives under src/test/java?</a></p>
  
  <p><a href="https://stackoverflow.com/questions/28285082/how-to-execute-a-java-class-file-from-maven-command-line">How to execute a java class file from maven command line</a></p>
  
  <p><a href="https://stackoverflow.com/questions/2472376/how-do-i-execute-a-program-using-maven">How do I execute a program using Maven?</a></p>
  
  <p><a href="https://stackoverflow.com/questions/1089285/maven-run-project">Maven Run Project</a></p>