[英]Need Help Packaging a GWT Library Module into a JAR
I am trying to package a GWT library module into a JAR file and use the library in a separate GWT web app by adding the JAR file into its class path. 我正在尝试将GWT库模块打包到JAR文件中,并通过将JAR文件添加到其类路径中,在单独的GWT Web应用程序中使用该库。
The JAR contains: JAR包含:
The library module is inherited from the web app: 库模块继承自Web应用程序:
<module> <!-- my web app's module descriptor -->
...
<inherits name="[path to my library module].Library"/>
...
</module>
However, I am running into 但是,我遇到了
Deferred binding failed for '[path to mylibrary].client.ClientFactory'...
error when I try to launch the web app, which initializes the library in its onModuleLoad() method. 我尝试启动Web应用程序时出错,该应用程序在其onModuleLoad()方法中初始化库。 The failure is caused by UiBinder views and RequestFactory that the library module uses. 失败是由库模块使用的UiBinder视图和RequestFactory引起的。 Launching in development mode or compiling the web app results in errors with messages stating missing CSS files and illegal references to generated source under emul.java.util package (I tried including this package and all other generated source in the JAR, but it didn't help.) 在开发模式下启动或编译Web应用程序会导致错误,消息显示缺少CSS文件以及在emul.java.util包下对生成的源的非法引用(我尝试在JAR中包含此包和所有其他生成的源,但它没有'帮忙。)
Can someone tell me what needs to be included in the JAR? 有人可以告诉我需要包含在JAR中的内容吗? Are there any additional resources required for library modules that use UiBinder and RequestFactory? 使用UiBinder和RequestFactory的库模块是否还需要其他资源?
Has anyone successfully packaged a GWT library module that uses RequestFactory and UiBinder into a JAR? 有没有人成功打包过一个将RequestFactory和UiBinder用于JAR的GWT库模块?
Further clarification: The question is about creating a GWT library module; 进一步澄清:问题是关于创建GWT库模块; a module that includes client and server components, RequestFactory and UiBinder. 包含客户端和服务器组件的模块,RequestFactory和UiBinder。 Note that a GWT library module is packaged into a JAR whereas a regular GWT module with an entry point is packaged into a WAR. 请注意,GWT库模块打包到JAR中,而带有入口点的常规GWT模块打包到WAR中。 My attempts to package such a library module and GWT <inherit>
from another GWT project have failed. 我尝试从另一个GWT项目打包这样的库模块和GWT <inherit>
失败了。
Either, I misunderstand your question, or you mis-correlated GWT compilation with Java byte-code compilation. 或者,我误解了你的问题,或者你错误地将GWT编译与Java字节码编译相关联。
Traditional Java development 传统的Java开发
Not so for GWT. 对于GWT来说并非如此。
GWT war GWT战争
Therefore , 因此 ,
In Conclusion 结论
Compiled GWT resources are unusable nor will they be visible for GWT development because ... GWT development requires java source, and GWT client deployment are javascript in war, and javascript is not like bytecode jars/files. 编译的GWT资源不可用也不会对GWT开发可见因为...... GWT开发需要java源,GWT客户端部署是javascript in war,而javascript不像字节码jar /文件。
Therefore, in GWT, there is "no such thing" as packaging a jar that is usable for both development and for deployment. 因此,在GWT中,包装可用于开发和部署的jar的“没有这样的东西”。 Some examples and tutorials do package development and deployment files into a single jar - but that jar is essentially a zip which you have to break up the deployment pieces from the development pieces first. 一些示例和教程将开发和部署文件打包到一个jar中 - 但该jar本质上是一个zip,您必须先从开发部分拆分部署部分。
GWT Development jars = source jars, GWT开发罐子=源罐子,
GWT Deployment = war of javascript and resources. GWT部署= javascript和资源的战争。
Before you launch yourself into GWT development, you should have at least 3-6 months' experience writing traditional JEE apps with JSP, servlets, HTML and javascript. 在开始进入GWT开发之前,您应该至少有3-6个月的经验,使用JSP,servlet,HTML和javascript编写传统的JEE应用程序。 That would help you inculcate a strong sense of segregation of server-side vs client-side, war vs jar and hence understand why GWT was invented in the first place. 这将有助于你灌输强烈的服务器端与客户端,战争与jar的隔离感,从而理解为什么GWT首先被发明。 You would understand the deployment process. 您将了解部署过程。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.