I'd start with a new maven project "mylib", which is based on a simple archetype-quickstart maven stub, and I'd add two subfolders under src/main/java/mylib:
- src/main/java/mylib/webThen, I'd add the following file:src/main/java/mylib/web.gwt.
xml...with the following content:<module><inherits name='com.google.gwt.user. User'/><source path='web'/></module>Then, I'd include mylib.general.* for server-side code, and mylib.web.* for GWT-based code.Would this be the right way?Could I place server-side only code under general (e. g. database related code) and GWT-based code under web?(I still feel that the GWT compiler then would "ignore" the code under the general folder, doesn't it?)
That would work, as long as src/main/java/mylib or src/main/java/mylib/general is not exposed to GWT compiler by any other GWT module you might have. With the above only src/main/java/mylib/web would be analyzed and compiled by GWT compiler. Its basically the same as with using client, shared and server folder but the *.gwt.xml only makes the client and shared folder visible to the GWT compiler.
An alternative approach for library code is to not split the code up into distinct packages like you did but instead use an annotation and then build two different jar's (one that only contains GWT code, and another only containing code incompatible to GWT) by reading the annotation. That is basically the approach Guava uses to build guava.jar and guava-gwt.jar.
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to email@example.com.
To post to this group, send email to firstname.lastname@example.org.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.