Good morning,
I'm a noob in using gwt-exporter.
I've starting playing with this tool because I would like to wirte pure js libraries starting from Java, and then share them with my work team that only works with javascript.
Until now I've done the following:
- installed Java 8 + Eclipse 4.3.2. Kepler
- installed Google / GWT plugins under Eclipse
- downloaded the gwt-export jar
The test I've run is the following:
- I've created a new Web Application Project without sample code
- I've added a .gwt.xml file in the src directory, in the path corresponding to the main package of the project
- I've added an entry point class for a subpackage "lib" (Lib_EntryPoint.java)
- I've added a library class to be converted into js (CSV.java)
The result is contained in this archive:
https://docs.google.com/uc?id=0B1XaMeHi9dz4WEcwdjZnWlJNMUk&export=downloadIf the link doesn't work, then try
https://drive.google.com/file/d/0B1XaMeHi9dz4WEcwdjZnWlJNMUk/edit?usp=sharing(then click on File -> Download)
While I compile the project in Eclipse (Google button -> GWT Compile Project...), the output I obtained until now is not what I really meant, so here are some questions, hoping that someone can give me a hint:
1 - I've seen that js code generated from the Java class CSV.java is located in the folder "war/module_name", not in a single js file as expected, but in different versions in several html files (some_MD5.cache.html).
Why isn't there a single file where my generated js is written?
Why the generated file is not in a js file, that can be included later by some other javascripts? How can I achieve this?
2 - Going straight to my goal, I would like to build modular libraries, and have a one-to-one correspondance between Java classes and js generated files, so that for example my CSV.java is translated into a CSV.js file containing only that class, and directly usable in a generic js context (browser, server, etc.).
Is there a known best-practice to do this? I've surfed the web a lot searching for tutorials / help, but I coulnd't find examples or articles describing how to afford my particular scenario.
3 - I've seen that my generated js packages / classes are a sub-member of the object $wnd, so that I have to call "new $wnd.com.example.codebase.lib.CSV()" instead of "new com.example.codebase.lib.CSV()".
Is there a way to tell the exporter that I want packages / classes callable in the second form?
Any help is greatly appreciated!
Alessio