title: How to invoke listener from pom.xml
body: <p>I have an extent report listener and am invoking it from testng.xml and it works perfectly fine. When I invoke the listener from my pom.xml it does not work fine. </p>
  
  <p>There are two questions I have here:</p>
  
  <ol>
  <li>Can I invoke the listener from the testNG.xml without adding the listener to the pom file?</li>
  <li>How to get the same output from the testNG.xml and the pom.xml?</li>
  </ol>
  
  <p>If need be I can attach my project as well here. Can some one please suggest what may have gone wrong here.</p>
  
  <p>My testng.xml file is like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;
  &lt;suite name="Suite" verbose="2" parallel="tests" thread-count="2"&gt;
  &lt;listeners&gt;
         &lt;listener class-name="ExtentReporterNG.ExtentTestNGIReporterListener"/&gt;
     &lt;/listeners&gt;
  
   &lt;test name="Regression1"&gt;
      &lt;classes&gt;
               &lt;class name="org.Sample1.AppTest"/&gt;
               &lt;class name="org.Sample2.AppTest"/&gt;
      &lt;/classes&gt;
    &lt;/test&gt;
   &lt;/suite&gt;
  </code></pre>
  
  <p>My pom.xml is like this:</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
    &lt;groupId&gt;com.test.sample&lt;/groupId&gt;
    &lt;artifactId&gt;SampleProject&lt;/artifactId&gt;
    &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
    &lt;packaging&gt;pom&lt;/packaging&gt;
  
    &lt;name&gt;SampleProject&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;dependencies&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;junit&lt;/groupId&gt;
        &lt;artifactId&gt;junit&lt;/artifactId&gt;
        &lt;version&gt;3.8.1&lt;/version&gt;
        &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;   
          &lt;dependency&gt;
              &lt;groupId&gt;org.testng&lt;/groupId&gt;
              &lt;artifactId&gt;testng&lt;/artifactId&gt;
              &lt;version&gt;6.9.10&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
            &lt;dependency&gt;
      &lt;groupId&gt;com.aventstack&lt;/groupId&gt;
      &lt;artifactId&gt;extentreports&lt;/artifactId&gt;
      &lt;version&gt;3.0.7&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;sample&lt;/groupId&gt;
      &lt;artifactId&gt;com.sample&lt;/artifactId&gt;
      &lt;version&gt;1.0&lt;/version&gt;
      &lt;scope&gt;system&lt;/scope&gt;
      &lt;systemPath&gt;C:\\Users\\pchand\\Desktop\\ExtentReport-0.0.1-SNAPSHOT.jar&lt;/systemPath&gt;
  &lt;/dependency&gt;
    &lt;/dependencies&gt;
    &lt;modules&gt;
      &lt;module&gt;Sample1&lt;/module&gt;
      &lt;module&gt;Sample2&lt;/module&gt;
    &lt;/modules&gt;
      &lt;build&gt;  
      &lt;pluginManagement&gt;
       &lt;plugins&gt;
  
        &lt;plugin&gt;
          &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
          &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
          &lt;version&gt;3.7.0&lt;/version&gt;
          &lt;configuration&gt;
            &lt;source&gt;1.8&lt;/source&gt;
            &lt;target&gt;1.8&lt;/target&gt;
          &lt;/configuration&gt;
        &lt;/plugin&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.19.1&lt;/version&gt;
             &lt;configuration&gt;
                &lt;testFailureIgnore&gt;true&lt;/testFailureIgnore&gt;
               &lt;suiteXmlFiles&gt;
                           &lt;suiteXmlFile&gt;testng.xml&lt;/suiteXmlFile&gt;
                      &lt;/suiteXmlFiles&gt;
             &lt;properties&gt;
      &lt;!--         &lt;property&gt;
                &lt;name&gt;usedefaultlisteners&lt;/name&gt;
                &lt;value&gt;false&lt;/value&gt; disabling default listeners is optional
              &lt;/property&gt; --&gt;
              &lt;property&gt;
                &lt;name&gt;listener&lt;/name&gt;
                &lt;value&gt;ExtentReporterNG.ExtentTestNGIReporterListener&lt;/value&gt;
              &lt;/property&gt;
            &lt;/properties&gt;
      &lt;/configuration&gt;
      &lt;/plugin&gt;
        &lt;/plugins&gt;
      &lt;/pluginManagement&gt;
    &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>