How to create a java project as a jar for GWT

509 Views Asked by At

I'm wanting to use some java code as a reusable component jar in my GWT 2.4 application. I need access to that code on the client side, so I've read that the steps involved are to

  1. add an entry in the main projects gwt.xml file pointing to this project,
  2. include a gwt.xml file in the jar
  3. and put the java code under a client folder.

I assume that this has to be a gwt project itself, otherwise there would be no need to add the inherits entry or is it not possible to use a regular java project client-side?

Is there anything else I need to do for this (other than ensure the libraries in the jar fall under the JRE Emulation Reference list)?

1

There are 1 best solutions below

0
On BEST ANSWER

We don't use the plugin functionality in Eclipse, but to use another project in your GWT project all you need to do is define a .gwt.xml module file in your project that you want to use in your GWT project and reference that module file with <inherits.../> in your main GWT project. You will also obviously need to add that project as a reference in the build path in Eclipse, so you don't get compilation errors. And all of that is besides the fact that your referenced project has to comply to the JRE emulation reference so it can be fully GWT compilable.