Gwt ClientBundle can't find images
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)
精彩评论