GWT compile: can not find <ui:image> in dependent jar

53 views
Skip to first unread message

July

unread,
May 31, 2012, 10:36:17 AM5/31/12
to google-we...@googlegroups.com

My project depends on the other project, i call it "common" because it contain some common widgets, some of these widget use UIbinder, i use something like below in the Uibinder:

<ui:image field='gwtLogo' src="gwtLogo.png" />

the common project is build as jar to be used in upper project, when upper GWT project compile, it can not find the  <ui:image defined as above and give compile error.

Anybody know how to solve this problem? Or any other ways to conquer this?

 thanks in advance.


Joseph Lust

unread,
Jun 1, 2012, 3:28:50 PM6/1/12
to google-we...@googlegroups.com
Try using a ClientBundle with ImageResource in the Common project. This will make it very easy to reference that bundle and all of its resources, so that you don't have to worry about relative file paths when trying to pull images out of it.

I like to have a resources package in a given widget's package. So you'd have the following structure:
com.yourCommonStuff.yourModule.client.widgets.yourWidget.resources (ClientBundle interfaces here)
com.yourCommonStuff.yourModule.client.widgets.yourWidget.resources.images (image files here)
com.yourCommonStuff.yourModule.client.widgets.yourWidget.resources.css ( css files here )
com.yourCommonStuff.yourModule.client.widgets.yourWidget (other widget stuff here)

This way everything for a widget is nice and self contained, rather than a bunch of widgets dumping all their CSS and images into a single public/ folder. It makes referencing files far easier, otherwise you end up with lines like @Source('../../../someOtherPkg/public/images/image.png').

Sincerely,
Joseph

July

unread,
Jun 2, 2012, 4:14:27 AM6/2/12
to google-we...@googlegroups.com
Thanks Joseph, As you said, ClientBundle is the way.
Reply all
Reply to author
Forward
0 new messages