如何使GWT在链接文件夹中查找源? [英] How to make GWT find source in linked folders?

查看:103
本文介绍了如何使GWT在链接文件夹中查找源?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个GWT(2.0.4)项目,但是我的源代码位于通用的Java目录下,不保存在GWT项目目录下。



我做了以下工作:



1)在包中创建新项目'游戏'com.mycomp.project.game 。这个工作正常,其来源位于C:\java\Projects\game\src\com\mycomp\project\game下。



2)将代码复制到C:\java\com\mycomp\project\game



3)删除C:\Projects\\下的目录4)文件,新建文件夹,高级/链接到文件系统中的文件夹,使src下的com文件夹链接到C:\\ game \src\



< \java\com。



这个工作已经足够了,我可以看到所有的源代码在 com.mycomp.project.game 文件夹,但是当我尝试运行我的项目时,我现在收到错误无法找到类型com.mycomp.project.game.client.Game'。



GWT是否不能与文件系统文件夹的这些链接工作?有没有办法让我将Java代码保存在我的项目目录之外的某个地方,但仍然可以在GWT中工作?



谢谢。

解决方案

您有两个选项。




  • 将源代码移动到目录下的GWT模块(.gwt.xml文件)位置,并更改< source path =/> 指向共享目录和客户端代码。

  • 使用要重用的源创建一个JAR文件。 JAR还必须有一个GWT模块。在您现有的项目中,您必须具有可重用JAR的< inherit ... />


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.

解决方案

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.

这篇关于如何使GWT在链接文件夹中查找源?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆