Question

The normal GWT projects have client code and server code. I want to write separate client and server code in same playN project. When I compile my current project I get errors like, couldn't find module, java.lang.Thread, as it is not supported by GWT client code. For my project I need lot of server code to be added and I need full Java packages.

And the main problem is, I have my own library with full of server side code, and when I add the library, I get this problem.

How can I separate the client code and server code such a way that it won't give me an error like mentioned above? If we can separate client and server code, is there a way to add the library only for server side code?

Thanks in advance..

Was it helpful?

Solution

I don't know PlayN, but in GWT you define which path are to be compiled for client side using

<source path='client' />

inside your .gwt.xml file. Other path under the module file folder are compiled as server side code.

In order to understand your problem more completely, I git-cloned the play sample showcase, then I took a look on the file hierarchy (the GWT part is detailed by the way).

showcase/
   android/
      ...
   core/
      ...
   flash/
      ...
   html/
      src/
         main/
            java/
               playn/
                  showcase/
                     html/
                        ShowcaseHtml.java
                     Showcase.gwt.xml
            webapp/
               WEB-INF/
                  web.xml
               Showcase.html
      pom.xml
   ios/
     ...
   java/
     ...
   build.xml
   pom.xml

As we can see we have html/src/main/java/playn/showcase/Showcase.gwt.xml side by side with html/src/main/java/playn/showcase/html folder.

Here is Showcase.gwt.xml content:

<module rename-to='showcase'>
  <inherits name='playn.PlayN'/>
  <!-- for the peas sample -->
  <inherits name="org.jbox2d.GwtBox2D" />
  <!-- for the menu UI -->
  <inherits name='tripleplay.TriplePlay'/>
  <!-- for enhanced logging -->
  <inherits name="playn.logging.Enhanced" />

  <source path='core'/>
  <source path='html'/>

  <public path="resources" />

  <entry-point class='playn.showcase.html.ShowcaseHtml'/>
</module>

So as for my experience if there exists a html/src/main/java/playn/showcase/server folder with code in it, and no reference made to this code from other code, it must be avoided by GWT compiler. Then with maven it could be compile if declared appriately.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top