How to make GWT find source in linked folders?

烈酒焚心 提交于 2020-01-02 05:59:29

问题


I'd like to create a GWT (2.0.4) project but with my source in a common java directory that's not kept under the GWT project directory.

I did the following:

1) Created new project 'game' in package com.mycomp.project.game. This worked fine, with its source under C:\java\Projects\game\src\com\mycomp\project\game.

2) Copied the code into C:\java\com\mycomp\project\game

3) Deleted the directories under C:\Projects\game\src\

4) File, New Folder, Advanced/Link to folder in filesystem to make a 'com' folder under src that links to C:\java\com.

This worked enough that I can see all the source under a com.mycomp.project.game folder in Eclipse, but when I try to run my project I now get errors of "Unable to find type 'com.mycomp.project.game.client.Game'".

Does GWT just not work with these links to filesystem folders? Is there any way for me to keep my Java code somewhere outside of my project directory but still have it work in GWT?

Thanks.


回答1:


You have two options.

  • Move the source code into a directory under your GWT module (.gwt.xml file) location and change the <source path="" /> to point to the shared directory and the client code.
  • Create a JAR file with the source you want to reuse. The JAR will also have to have a GWT module. In your existing project you'll have to <inherit ... /> that reusable JAR.


来源:https://stackoverflow.com/questions/3538901/how-to-make-gwt-find-source-in-linked-folders

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