Looking at the GWT sample apps and the RPC tutorial the following package conventions are used:
./client/GreetingService.java
./client/GreetingServiceAsync.java
./server/GreetingServiceImpl.java
Though the GWT docs are very sparse on best-practices what components get included where at runtime, the clear intuition is:
- client – Compiled into JavaScript by GWT compiler
- server – Compiled into bytecode by javac
- shared – Compiled into JavaScript by GWT compiler and compiled into bytecode by javac
This would lead one to believe that code in client should not be on the compile-time sourcepath of javac. Yet since GreetingServiceImpl implements GreetingService, clearly code in client needs to be on the sourcepath during compilation, and included on the runtime classpath at deployment.
Given this, why doesn’t the GreetingService interface go in shared?
If you try to put it in shared, the GWT Eclipse Plugin complains “Missing Asynchronous Interface”…
Let’s try to be clear :
Serviceinterface must be available to your client code. So it must either be in the client package or the shared package. But theServiceAsyncinterface must be in the same package as theServiceinterface. And theServiceAsyncis certainly not something that is considered shared between client and server. So theServiceASyncinterface should be in the client package.Serviceinterface is put in the client package.ServiceASyncinterface was not found in theServiceinterface package.Does that answer your question?