GWT-出口国。工作实例

时间:2015-06-22 22:07:09

标签: javascript java gwt gwt-exporter

我有一个Java库,我需要将它转换为JS。我找到了使用gwt-exporter的解决方案GWT to create utility javascript library。我之前从未使用过GWT。我试过GWT-exporter. Getting started,但不清楚如何使用它。简单地说如何运行项目来生成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的依赖关系?

也许有人可以分享工作实例?

2 个答案:

答案 0 :(得分:0)

https://code.google.com/p/gwt-exporter/wiki/GettingStarted 很穷。 为了编译JS,我添加了gwt-maven-plugin

我还创建了.gwt.xml文件,其中包含我的模块的描述。

以下依赖是强制性的

    <dependency>
        <groupId>com.google.gwt</groupId>
        <artifactId>gwt-user</artifactId>
        <scope>provided</scope>
    </dependency>

答案 1 :(得分:0)

除了将gwt-exporter添加到类路径之外,您是否更新了继承gwt-exporter依赖项的模块文件(application_name.gwt.xml)?

如果是这样,在此文件中,您应该有一个入口点标记,指向应用程序启动时要运行的类。打开该java文件并添加exportAll调用。

最后访问您想要在javascript中提供的所有类/方法,并在指示入门页面中对其进行适当注释

相关问题