Gwt ClientBundle 找不到图像
ClientBundle 在我的主项目中工作正常:com.example.project.client.Bundle
我的库中的另一个 ClientBundle 可以很好地编译成 jar:com.example.library.client.Bundle< /code>
当项目依赖于库时编译它失败:
[ERROR] Errors in 'jar:file:/C:/work/library.jar!/com/example/library/client/Bundle.java'
[ERROR] Line 10: Failed to resolve 'com.example.library.client.Bundle' via deferred binding
我检查了库 jar,并且图像文件位于 /com/example/library/client/
中,就像它们在库中一样来源。有什么技巧吗?我尝试使用 @ClientBundle.Source("com/example/library/client/icon.gif")
和 @ClientBundle.Source("icon.gif") 引用图像
,两者都允许库编译文件,但在编译依赖项目时失败。
A ClientBundle works fine in my main project: com.example.project.client.Bundle
Another ClientBundle in my library compiles into a jar just fine: com.example.library.client.Bundle
Compiling my project when it depends on the library fails:
[ERROR] Errors in 'jar:file:/C:/work/library.jar!/com/example/library/client/Bundle.java'
[ERROR] Line 10: Failed to resolve 'com.example.library.client.Bundle' via deferred binding
I've checked the library jar, and the image files are at /com/example/library/client/
as they were in the library's source. Is there some trick? I've tried referencing the images both with @ClientBundle.Source("com/example/library/client/icon.gif")
and @ClientBundle.Source("icon.gif")
, both of which allow the library to compile file, but fail when compiling the depending project.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看来是我的错。我引用了 icon.gif 但实际上文件系统中有 icon.png 。简单的错字。
我最大的错误是混淆了编译步骤。当您拥有 GWT 库并将其编译成 jar 时,您并不是进行 GWT 编译。因此,您实际上并未验证任何 ClientBundle 注释。在依赖项目进行完整的 GWT 编译之前,验证不会发生(这就是我失败的地方)
Looks like it was my fault. I was referencing icon.gif but actually had icon.png in the filesystem. Simple typo.
My big mistake was confusing the compilation steps. When you have a GWT library, and compile it into a jar, you're not doing a GWT compile. So you're not actually verifying any of the ClientBundle annotations. That verification doesn't happen until a depending project does a full GWT compile (and that's where it was failing for me)