GWT出口商.工作实例 [英] GWT-exporter. Working example
问题描述
我有一个Java库,需要将其转换为JS.我找到了 GWT创建实用程序javascript库以使用gwt-exporter的解决方案.我以前从未使用过GWT.我尝试了 GWT导出程序.入门,但尚不清楚如何使用它.简单地讲,如何运行项目以生成JS?
I have a Java lib and I need to convert it to JS. I found the solution GWT to create utility javascript library to use gwt-exporter. I never used GWT before. I tried GWT-exporter. Getting started but it's not clear how to use it. Simply how to run the project to generate JS?
pom.xml
<dependencies>
<dependency>
<groupId>org.timepedia.exporter</groupId>
<artifactId>gwtexporter</artifactId>
<version>2.4.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
Java类:
import org.timepedia.exporter.client.ExporterUtil;
public class JS implements EntryPoint {
public void onModuleLoad() {
// Export all Exportable classes
ExporterUtil.exportAll();
}
}
在哪里找到EntryPoint
的依赖项?
也许有人可以分享工作示例?
Maybe someone can share working example?
推荐答案
除了将gwt-exporter添加到类路径之外,您是否还继承了gwt-exporter依赖项来更新模块文件(application_name.gwt.xml)?
Apart from adding gwt-exporter to your class-path, did you update your module file (application_name.gwt.xml) inheriting the gwt-exporter dependency?.
如果是这样,在此文件中,您应该有一个指向该应用程序启动时要运行的类的入口标记.打开该Java文件并添加exportAll
调用.
If so, in this file you should have an entry-point tag pointing to the class to run when the app starts. Open that java file and add the exportAll
call.
最后访问您要在javascript中提供的所有类/方法,并对它们进行适当的注释,如指示入门页面中所示
Finally visit all the classes/methods you want to make available in javascript and annotate them appropriately like in the getting started page is indicated
这篇关于GWT出口商.工作实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!