Gwt ClientBundle 找不到图像

发布于 2024-09-15 19:36:47 字数 660 浏览 2 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

调妓 2024-09-22 19:36:47

看来是我的错。我引用了 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)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文