【问题标题】:GWT-exporter. Working exampleGWT 出口商。工作示例
【发布时间】:2015-09-08 12:52:13
【问题描述】:

我有一个 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 的依赖项?

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

【问题讨论】:

    标签: javascript java gwt gwt-exporter


    【解决方案1】:

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

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

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

    【讨论】:

      【解决方案2】:

      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>
      

      【讨论】:

      • 很高兴你知道了!
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多