title: how to pass testng.xml parameter value through mvn command line
body: <p>Below <code>testng.xml</code> file has three parameters. I don't want parameter <code>customerCode</code> to be hardcoded. I want to pass varying/diffent <code>customerCode</code> to the following <code>testng.xml</code> file, but also I want to have Peter as a default <code>customerCode</code> if just in case I don't provide one through <code>mvn</code> command line as follows:</p>
  
  <pre><code>mvn test -DcustomerCode=customer1 -Ptestng.xml
  </code></pre>
  
  <p>Below is the <code>testng.xml</code> file:</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 name="TestSuite" parallel="false"&gt;
  
      &lt;test name="someTest"&gt;
          &lt;parameter name="browserType" value="chrome_win"&gt;&lt;/parameter&gt;
          &lt;parameter name="Url" value="http://regression.mytest.com/?customerCode=" /&gt;
          &lt;parameter name="customerCode" value="Peter"/&gt;
  
          &lt;groups&gt;
              &lt;run&gt;
                  &lt;exclude name="navigateToHomePage" /&gt;
              &lt;/run&gt;
          &lt;/groups&gt;
          &lt;classes&gt;
              &lt;class name="com.automation.customermanagement.createTest.myIntegrationTest" &gt;
              &lt;methods&gt;
                  &lt;exclude name="deleteCustomer" /&gt;
              &lt;/methods&gt;
              &lt;/class&gt;
          &lt;/classes&gt;
      &lt;/test&gt;
  &lt;/suite&gt;
  </code></pre>
  
  <p>How do I achieve that? Is there a way to do that?</p>
  
  <p>Below is my POM file. Where do I put <code>customerCode</code> property inside the profile?</p>
  
  <pre><code>&lt;profile&gt;
      &lt;id&gt;AddMgmtTest&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-compiler-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.5.1&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;suiteXmlFiles&gt;
                          &lt;suiteXmlFile&gt;admgmttestng.xml&lt;/suiteXmlFile&gt;
                      &lt;/suiteXmlFiles&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  &lt;/profile&gt;
  </code></pre>