Strategies for mixing in the gwt compatible and non compatible source

徘徊边缘 提交于 2019-12-11 05:42:01

问题


Yes i know one alternative to solving this problem is simply to create two source directories from the original. The class path for the GWT compiler would thus be setup to simply only see the compatible source while both would be used for the server portion of your app.

Firstly i find this kind of ugly, because it means i now have two source directories with potential doubles of classes.

  • refactoring and other structural abilities of the IDE can potentially be problematic as it will get confused.
  • Sometimes its not possible to put some stuff in separate packages: think client and server packages simply because one would then have to make something public which should really be package private to limit scope accessibility.
  • is there a library that enables classes or methods to marked as ignored by the GWT compiler ?

Is there a better way ?


回答1:


You can exclude classes (files actually) from GWT's source path using Ant-like includes/excludes: http://code.google.com/webtoolkit/doc/latest/DevGuideOrganizingProjects.html#DevGuidePathFiltering You cannot exclude methods or inner classes though, it really is file-based. See http://code.google.com/p/google-web-toolkit/issues/detail?id=3769




回答2:


Make a shared directory that has the code that both the GWT side and server side can read. Any classes that would be duplicated instead go into this folder, to be accessed (without duplication!) from both client- and server-sides of your app.



来源:https://stackoverflow.com/questions/6066431/strategies-for-mixing-in-the-gwt-compatible-and-non-compatible-source

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!