Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gwt test: unable to find sample.gwt.xml on your classpath

I'm running gwt test for my application, it's like a nightmare, got problem one after another, not sure what's going wrong.

First, I created a dummy test case:

public class ListItemTest extends GWTTestCase {

  /**
   * Specifies a module to use when running this test case. The returned
   * module must include the source for this class.
   * 
   * @see com.google.gwt.junit.client.GWTTestCase#getModuleName()
   */
    @Override
    public String getModuleName() {
        return "com.dyihi.services.sample.Sample";
    }

    /**
     * Add as many tests as you like
     */
    public void testSimple() {
        assertTrue(true);
    }
}

When I ran 'mvn test' this simple test failed. The error message is:

initializationError0
java.lang.NoClassDefFoundError: com/google/gwt/dev/cfg/Condition

I googled around and found out that I need to include gwt-dev in my pom, and I did that, ran the test again, now it threw error:

[ERROR] Unable to find 'Sample.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?

like image 238
user468587 Avatar asked Dec 28 '10 23:12

user468587


2 Answers

I found Eclipse's Run Configuration Classpath tab worked for me.

You might already have an entry like java - appnameis/src/main/

It seems a pointless hack but the following worked for me

Press the Green "Play" button > Run configurations > Classpath tab

Select one of the User Entries e.g. java - appnameis/src/main/

Select the Advanced button

Select Add Folders drill down to appnameis/src/main/java/app/name OK

You now have entries like:

java - appnameis/src/main/

is - appnameis/src/main/java/app/name

Where your appnameis.gwt.xml file is directly under the is folder

Run

like image 187
TheSolarSheriff Avatar answered Oct 09 '22 17:10

TheSolarSheriff


Check under Run Configurations in Eclipse, and check the Arguments tab. If the class is moved, Eclipse won't update the command line arguments.

like image 44
Moshe Avatar answered Oct 09 '22 17:10

Moshe