title: TestNG Cannot find class in classpath once a new scala class is added to the suite.xml file
body: <p>Seems like this is a very "popular" question on SO with no definitive way to fix it but I'm asking the question anyway because I can provide some more details. I'm using STS v3.4.0.RELEASE and TestNG v6.8.6.20141201_2240. I also have the ScalaIDE plugin for Eclipse 3.0.4.v-2_11-201407232043.</p>
  
  <p>I've got a simple test (MusicalTest.java in my src/test/java) and its corresponding testsuite.xml file that outlines this class with specific method to be included. I run the xml file as a TestNG test and there are no issues, things run just as expected; my testsuite.xml file looks something like this:</p>
  
  <pre><code>&lt;!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"&gt;
  &lt;suite thread-count="1" verbose="1" name="Fishy Tests"
      skipfailedinvocationcounts="false" junit="false" parallel="methods"
      data-provider-thread-count="1" annotations="JDK"&gt;
  
      &lt;test verbose="2" name="MusicalTestSuite" annotations="JDK" preserve-order="true"&gt;
          &lt;classes&gt;
              &lt;class name="com.rock.and.roll.MusicalTest"/&gt;
          &lt;/classes&gt;
      &lt;/test&gt;
  &lt;/suite&gt;
  </code></pre>
  
  <p>Now I create a new class (in my case, I created a Scala class in the same package as the above test) called MusicalScalaTest.scala. I go ahead and include it in my testsuite.xml as follows:</p>
  
  <pre><code>&lt;!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"&gt;
  &lt;suite thread-count="1" verbose="1" name="Fishy Tests"
      skipfailedinvocationcounts="false" junit="false" parallel="methods"
      data-provider-thread-count="1" annotations="JDK"&gt;
  
      &lt;test verbose="2" name="MusicalTestSuite" annotations="JDK" preserve-order="true"&gt;
          &lt;classes&gt;
              &lt;class name="com.rock.and.roll.MusicalTest"/&gt;
              &lt;class name="com.rock.and.roll.MusicalScalaTest"/&gt;
          &lt;/classes&gt;
      &lt;/test&gt;
  &lt;/suite&gt;
  </code></pre>
  
  <p>Now when I run the xml file as a testNG test, I run into the following error:</p>
  
  <pre><code>org.testng.TestNGException:
  Cannot find class in classpath: com.rock.and.roll.MusicalTest
      at org.testng.xml.XmlClass.loadClass(XmlClass.java:81)
      at org.testng.xml.XmlClass.init(XmlClass.java:73)
      at org.testng.xml.XmlClass.&lt;init&gt;(XmlClass.java:59)
      at org.testng.xml.TestNGContentHandler.startElement(TestNGContentHandler.java:543)
      at ........ &lt;truncated&gt;
      at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
  </code></pre>
  
  <p>Interestingly enough, it doesn't complain about the MusicalScalaTest but complains about the MusicalTest instead. I go ahead and comment out the MusicalScalaTest class in the XML file thinking that that's what's causing the confusion, but on running the testNG test I run into the same error again! After this, I delete the MusicalScalaTest.scala class and delete the "commented" out line from the xml. No dice. I right click on the project and do a Run As -> Mvn Clean. No dice. I restart my IDE, do a Mvn Clean, and Maven Update Project followed by a refresh. No dice. I uninstall the testNG plugin, run a mvn clean test-compile just to be sure and then go through the usual motions of maven update project followed by a refresh. Then I reinstall the testNG IDE and give the same xml a whirl. No dice.</p>
  
  <p>Frankly <a href="https://github.com/cbeust/testng-eclipse/issues/84" rel="nofollow">this smells like a test-ng plugin-based issue</a> that has cached some error that it's not willing to purge. I try to run any other testsuite xml files of the same project and they are all complaining with the same error! So basically all my testSuite xml's are out of commission.</p>
  
  <p>Anybody have any recommendations on next steps? I'm trying to make all this work within the IDE as opposed to shifting to the terminal and running testNG through there. If you think it's not worth it at this point, drop a comment regardless.</p>