开发者

Gwt ClientBundle can't find images

开发者 https://www.devze.com 2023-01-12 14:17 出处:网络
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

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 li开发者_如何学Cbrary 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.


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)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号