2015-06-22 17 views
2

我有一個Java庫,我需要將其轉換爲JS。我發現解決方案GWT to create utility javascript library使用gwt-exporter。我以前從未使用過GWT。我試過GWT-exporter. Getting started,但不清楚如何使用它。簡單地如何運行該項目來生成JS?GWT-出口商。工作示例

import org.timepedia.exporter.client.ExporterUtil; 

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

}

哪裏可以找到相關性爲EntryPoint

的pom.xml

<dependencies> 
    <dependency> 
     <groupId>org.timepedia.exporter</groupId> 
     <artifactId>gwtexporter</artifactId> 
     <version>2.4.0</version> 
     <scope>provided</scope> 
    </dependency> 
</dependencies> 

Java類?

也許有人可以分享工作的例子嗎?

回答

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> 
+0

高興你理解了它的類/方法! –

0

除了加入GWT-出口到類路徑,你更新你的模塊文件(application_name.gwt.xml)繼承GWT-出口的依賴?

如果是這樣,在這個文件中,您應該有一個指向該類的入口點標記,以便在應用程序啓動時運行。打開該java文件並添加exportAll調用。

最後訪問所有你想在JavaScript中提供並在入門頁面適當加以註釋等中指出