GWT-exporter. Working example
Asked Answered
S

2

3

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 class:

import org.timepedia.exporter.client.ExporterUtil;

public class JS implements EntryPoint {
public void onModuleLoad() {
    // Export all Exportable classes
    ExporterUtil.exportAll();
}

}

Where to find dependency for EntryPoint?

Maybe someone can share working example?

Skull answered 22/6, 2015 at 22:7 Comment(0)
S
0

https://code.google.com/p/gwt-exporter/wiki/GettingStarted is poor. To compile JS I added gwt-maven-plugin.

Also I created .gwt.xml file with description of my module.

Following dependency is mandatory

    <dependency>
        <groupId>com.google.gwt</groupId>
        <artifactId>gwt-user</artifactId>
        <scope>provided</scope>
    </dependency>
Skull answered 23/6, 2015 at 10:18 Comment(1)
Glad you figured it out!Stay
S
0

Apart from adding gwt-exporter to your class-path, did you update your module file (application_name.gwt.xml) inheriting the gwt-exporter dependency?.

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.

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

Sapheaded answered 24/6, 2015 at 5:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.