GWT Compiler can't find gwt.xml

2020-05-24 19:56发布

问题:

I have changed and renamed my package structure of my GWT project, and when trying to run the project as a web application, the module isn't found and I get the following message:

[ERROR] Unable to find 'de/xx/focus/My_Projekt.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?
[ERROR] shell failed in doStartup method

Which class is used to load the module, and where to update the new path, respectively?

回答1:

I spent an hour staring at my gwt.xml file trying to figure out what I had done wrong after restructuring a project. Turned out it was in a sub-package of client instead of client itself. Right at the bottom of a long list of packages and sub-packages too. So in Eclipse's tree view, it looked like it was in the right place. Finally I realized it was one level in too deep. Face-palm time. I would also study the Run Configurations. If you are using Eclipse and you regularly do a "Run As" then "Web Configuration", this time do "Run As" and select "Run Configurations" at the bottom of the sub-menu. Go through it, tab by tab, but in particular study the "Arguments" tab and see if it needs to be updated. You can also get to the settings view the Project -> Properties -> Run/Debug Settings.



回答2:

Also under "Run Configurations..." > GWT tab, I had to remove and then re-add my app's sole GWT module. Only after doing this I could run the app again.



回答3:

I also had the same error. When I looked at the program arguments (Run As ----> Run Configurations... ---> Arguments) I found that com.google.gwt.sample got appended to my project name.

I removed this and it now works fine. The name of my project is SampleProject and it is in package samples

The arguments now look like below -

-remoteUI "${gwt_remote_ui_server_port}:${unique_id}" -startupUrl SampleProject.html -logLevel INFO -codeServerPort 9997 -port 8888 -war D:\eclipse\myprojects\SampleProject\war samples.SampleProject

Strangely enough this problem only occurred the first time. After correcting it the first time subsequent new projects worked fine.



回答4:

I think the simplest way is stopping all running projects with that specific name and then remove older run configurations for that specific project.

After that run the project again and it will be good.

I think the source of the problem is an older run configuration for the project. In my case I deleted sample code and later re-generated under the same name but as I realized at last not under the same package name. Eclipse used old run configuration for the new project because of the matching of the names.



回答5:

If you use Intellij. The resource dir look like this me.wener.test.somehow, maybe, this is only one dir with that name. not me/wener/test/somehow.But they look the same~ shit~



回答6:

I was debugging this same error, only for us it was with an Ant build that worked fine on Mac OS X but would fail on the Linux-based CI build servers.

Solution was simple... the file was named ModuleName.gwt.xml but the module was named modulename. The build would look for modulename.gwt.xml and on the Mac the filesystem is case insensitive by default so there was no problem. On linux, it couldn't find the file and we'd get this error. To resolve, just renamed the file to modulename.gwt.xml.



回答7:

Also Check if you are using JRebel it caches run configuration to do this : right click on project>> JRebel >> remove nature add the nature again and run