How do we add an 开发者_Go百科external .jar package in Google Web Toolkit (GWT)? I have followed the steps
1) added the .jar in classpath
2) added <inherits name='org.scribe.model' /> in my test.gwt.xmlI get this error:
Loading inherited module 'org.scribe.model'
[ERROR] Unable to find 'org/scribe/model.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source? [ERROR] Line 8: Unexpected exception while processing element 'inherits'However, I have found from many sources that you need the source files to compile the client side gwt. My question is what if one cannot get a source file of the .jar package? What is the workaround?
Thanks in advance.
If it is a GWT module it is packaged with sources. Check the jar Java files should be in it.
There are two ways to use a 3rd party dependency in your GWT
application.
- It is either a
GWT
module already which contains a module xml file along with the source files. In this case you just refer to it usinginherits
. - Or it is some regular 3rd party dependency in this case you need the source code and you also have to play with the package names since
GWT
requires source code to be underclient
package. Even you do so since the artifact is not developedGWT
in mind, it might most likely contain code that is not allowed byGWT
, e.g. you cannot useThread
s in GWT.
There is no workaround. You need source files.. At least you can decompile class files..
My suggestion would be to handle intense logic on server side (within server package)
On the server side , you can use classes that are not supported by GWT front-end (classes in client package).
E.g When I tried to use BufferedReader in client, I got exceptions, I then moved it to server package and retuned the result. The same was for RE which didn't work in client code too.
Keep your client code as simple as possible. Hope this helps.
Cheers PB
精彩评论