GWT 编译器找不到 gwt.xml
我更改并重命名了 GWT 项目的包结构,当 尝试将项目作为 Web 应用程序运行,但该模块不是 找到并收到以下消息:
[错误] 在您的计算机上找不到“de/xx/focus/My_Projekt.gwt.xml” 类路径;可能是拼写错误,或者您可能忘记包含类路径 来源条目?
[错误] shell 在 doStartup 方法中失败
哪个类用于加载模块,以及分别在哪里更新新路径?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
我花了一个小时盯着 gwt.xml 文件,试图找出在重组项目后我做错了什么。结果发现它是在客户端的子包中而不是客户端本身。也位于一长串包和子包列表的底部。因此,在 Eclipse 的树视图中,它看起来位于正确的位置。最后我意识到这是一个太深的层次。拍脸时间。我还会研究运行配置。如果您使用 Eclipse 并且经常执行“Run As”然后“Web Configuration”,这次执行“Run As”并选择子菜单底部的“Run Configurations”。逐个选项卡浏览它,但要特别研究“参数”选项卡,看看它是否需要更新。您还可以进入设置查看项目->属性->运行/调试设置。
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.
也在“运行配置...”下> GWT 选项卡,我必须删除然后重新添加我的应用程序的唯一 GWT 模块。只有这样做之后我才能再次运行该应用程序。
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.
我也有同样的错误。当我查看程序参数(运行方式 ----> 运行配置... ---> 参数)时,我发现 com.google.gwt.sample 已附加到我的项目名称中。
我删除了它,现在工作正常。我的项目的名称是 SampleProject,它位于 samples 包中
现在参数如下所示 -
-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
奇怪的是这个问题只出现在第一次。第一次纠正后,后续的新项目工作正常。
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.
我认为最简单的方法是停止具有该特定名称的所有正在运行的项目,然后删除该特定项目的旧运行配置。
之后再次运行项目就可以了。
我认为问题的根源是该项目的旧运行配置。就我而言,我删除了示例代码,然后以相同的名称重新生成,但我最终意识到不是以相同的包名称生成。由于名称匹配,Eclipse 使用新项目的旧运行配置。
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.
如果你使用Intellij。资源目录看起来像这样
me.wener.test.somehow
,也许,这只是一个具有该名称的目录。不是me/wener/test/somehow
。但它们看起来是一样的~妈的~If you use Intellij. The resource dir look like this
me.wener.test.somehow
, maybe, this is only one dir with that name. notme/wener/test/somehow
.But they look the same~ shit~我正在调试同样的错误,仅对我们来说,它是在 Mac OS X 上运行良好的 Ant 构建,但在基于 Linux 的 CI 构建服务器上会失败。
解决方案很简单...文件名为 ModuleName.gwt.xml,但模块名为 modulename。构建将查找 modulename.gwt.xml,并且在 Mac 上,文件系统默认不区分大小写,因此没有问题。在 Linux 上,它找不到该文件,我们会收到此错误。要解决此问题,只需将文件重命名为 modulename.gwt.xml。
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.
另请检查您是否使用 JRebel 来缓存运行配置来执行此操作:右键单击项目>> JRebel>>去除自然
再次添加性质并运行
Also Check if you are using
JRebel
it caches run configuration to do this : right click on project>> JRebel >> remove natureadd the nature again and run
发生此问题的原因是在参数中的项目运行配置中,在原始包名称之前附加了额外的或旧的包名称,因此一旦将其删除,它将正常工作。
在Eclipse中“Run As”并选择“Run Configurations”子菜单中选择“Arguments”选项卡并修改包名称通过删除现有的包名称,在参数末尾给出 gwt.xml 存在的项目的包名称。完成后运行它
例如:1
下面是我创建的最后一个示例项目。
[-noprecompile、-port、9876、-sourceLevel、1.8、-bindAddress、127.0.0.1、-launcherDir、D:\eclipse-workspace\Sample-Porject\war、-logLevel、INFO、-style、OBFUSCATED、 com.gwt.sample.Sample_Porject]
例如:2
然后我再次创建了新的示例包,但是当我运行它时它显示错误,如下所示
[-noprecompile、-port、9876、-sourceLevel、1.8、-bindAddress、127.0.0.1、-launcherDir、D:\eclipse-workspace\New-Project\war、-logLevel、INFO、-style、OBFUSCATED、 com.gwt.sample.Sample_Project,com.domain.learn.project.New_Project]
修改
在 Eg: 2 中,粗体部分是我创建的旧项目包名称,需要将其删除,然后项目才能正常运行。去掉后是这个样子
[-noprecompile、-port、9876、-sourceLevel、1.8、-bindAddress、127.0.0.1、-launcherDir、D:\eclipse-workspace\New-Project\war、-logLevel、INFO、-style、OBFUSCATED、 com.domain.learn.project.New_Project]
This issue occurred because in the project run configuration in the arguments there is an extra or old package name appended before the original package name so once it is removed it will be works fine.
In Eclipse "Run As" and select "Run Configurations" at the sub-menu select "Arguments" tab and modify the package name at the end of the argument by removing the existing package name give the package name of your project where the gwt.xml present. once done run it
Eg: 1
Below is the last sample project I have been created.
[-noprecompile, -port, 9876, -sourceLevel, 1.8, -bindAddress, 127.0.0.1, -launcherDir, D:\eclipse-workspace\Sample-Porject\war, -logLevel, INFO, -style, OBFUSCATED, com.gwt.sample.Sample_Porject]
Eg: 2
Then I again created new sample package but when I run it It showed an error and it looked like below
[-noprecompile, -port, 9876, -sourceLevel, 1.8, -bindAddress, 127.0.0.1, -launcherDir, D:\eclipse-workspace\New-Project\war, -logLevel, INFO, -style, OBFUSCATED, com.gwt.sample.Sample_Project, com.domain.learn.project.New_Project]
Modification
In Eg: 2 the bold part is the old project package name I created it need to be removed then the project will run fine. After removing it It look like this
[-noprecompile, -port, 9876, -sourceLevel, 1.8, -bindAddress, 127.0.0.1, -launcherDir, D:\eclipse-workspace\New-Project\war, -logLevel, INFO, -style, OBFUSCATED, com.domain.learn.project.New_Project]