title: Error when creating an executable test-jar in Maven
body: <p>I'm trying to create a JAR that I can put on a non development machine and run some unit tests that exercise a web service.  I've read that there are many ways to do this in maven.  I'm focusing on using the test-jar goal because that seems the most logical approach.</p>
  
  <p>My tests are in a separate maven project with a folder structure of:</p>
  
  <pre><code>/myProject/src/test/java/org/testplatform/services/test/&lt;name of testng test&gt;.java
  </code></pre>
  
  <p>Here is my config for the test-jar in the pom:</p>
  
  <pre><code>        &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-jar-plugin&lt;/artifactId&gt;
              &lt;executions&gt;
                &lt;execution&gt;
                  &lt;goals&gt;
                    &lt;goal&gt;test-jar&lt;/goal&gt;
                  &lt;/goals&gt;
                &lt;/execution&gt;
              &lt;/executions&gt;
              &lt;configuration&gt;
                  &lt;archive&gt;
                      &lt;manifest&gt;
                          &lt;addClasspath&gt;true&lt;/addClasspath&gt;
                          &lt;mainClass&gt;org/testplatform/services/test/MainTestClass.java&lt;/mainClass&gt;
                      &lt;/manifest&gt;
                  &lt;/archive&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
  </code></pre>
  
  <p>When I execute the resulting JAR I get this error:</p>
  
  <pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: org/testng/ITestListener
  Caused by: java.lang.ClassNotFoundException: org.testng.ITestListener
  at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
  </code></pre>
  
  <p>Can someone help me understand what changes I need to make in my pom and/or tests to create an independent, executable JAR for running testng unit tests?  A demo project would be helpful.</p>