Eclipse 3.4 GWT 1.6项目 - 如何从其他项目引用源? [英] Eclipse 3.4 GWT 1.6 project - how to reference source from other projects?

查看:106
本文介绍了Eclipse 3.4 GWT 1.6项目 - 如何从其他项目引用源?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Eclipse 3.4中有一个GWT 1.6项目,并试图从我的工作区中另一个(非GWT )项目引用源代码。我已将项目添加到我的构建路径,但我无法在托管模式下运行该应用程序。当我做,我得到一个没有源代码可用错误。



我已经做了一些搜索和阅读,并尝试了其他人建议的一些东西包括从依赖项目创建一个jar并链接到它),但坦率地说,没有任何工作。



如果你真的这样做,可以帮助我一个简单的分步安装?我真的很感激,谢谢!

解决方案

我有2个Eclipse项目。一个是gwt项目,一个不是。以下是我的目录结构:

  workspace 
- gwt-project
- src / main / java
- com.gwt.GwtProjectModule
- GwtProjectModule.gwt.xml
- 非gwt-project
- src / main / java
- com.nongwt.package.that.contains.source.you.need
- nongwt.gwt.xml
- com.nongwt.package.that.contains.source.you。 need.client

nongwt.gwt.xml告诉gwt查看客户端包,这里是什么看起来像:

 <?xml version =1.0encoding =UTF-8?> 
<!DOCTYPE模块PUBLIC - // Google Inc.//DTD Google Web Toolkit 1.7.0 // ENhttp://google-web-toolkit.googlecode.com/svn/tags/1.7 0.0 /发行源/型芯/ SRC / GWT-module.dtd>
< module rename-to ='nongwt'>
< inherits name ='com.google.gwt.user.User'/>
< source path =client/>
< / module>

GwtProjectModule.gwt.xml可以继承nongwt的源代码。这是GwtProjectModule.gwt.xml内的相关行:

 < inherits name =com.nongwt.package.that。 contains.source.you.need.nongwt/> 

确保您在eclipse中的gwt-project的classpath中包含非gwt-project。这是正常的演习右键单击gwt-project,选择属性,选择Java Build Path,单击Projects选项卡,non-gwt-project



或者,而不是包括在gwt-project的classpath中的非gwt项目作为项目引用,还可以对非gwt - project的内容进行jar包,确保将源包含在jar中,然后将jar包含在gwt-project的classpath中



祝你好运!


I've got a GWT 1.6 project in Eclipse 3.4 and am trying to reference source from another (non-GWT) project in my workspace. I've added the project to my build path, but I can't run the application in hosted mode. When I do, I get a "no source code is available" error.

I've done some searching and reading and have tried a few things that others have suggested (including creating a jar from the dependent project and linking to it), but frankly nothing has worked.

If you're actually doing this, could you please help me out with a simple step-by-step setup? I'd really appreciate it, thanks!

解决方案

I have 2 Eclipse Projects. One is gwt project and one is not. Here's the directory structure that works for me:

workspace
-- gwt-project
   -- src/main/java
      -- com.gwt.GwtProjectModule
         -- GwtProjectModule.gwt.xml
-- non-gwt-project
   -- src/main/java
      -- com.nongwt.package.that.contains.source.you.need
         -- nongwt.gwt.xml
      -- com.nongwt.package.that.contains.source.you.need.client

nongwt.gwt.xml tells gwt to look inside "client" package, here's what it looks like:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.7.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/1.7.0/distro-source/core/src/gwt-module.dtd">
<module rename-to='nongwt'>
    <inherits name='com.google.gwt.user.User' />
    <source path="client" />
</module>

GwtProjectModule.gwt.xml can then inherit source code from nongwt. Here's the relevant line from inside GwtProjectModule.gwt.xml:

<inherits name="com.nongwt.package.that.contains.source.you.need.nongwt" />

Make sure you include non-gwt-project inside gwt-project's classpath in eclipse. It's the normal drill; right click on gwt-project, choose properties, choose "Java Build Path", click "Projects" tab, and "non-gwt-project"

Or, instead of including non-gwt-project in gwt-project's classpath as a project reference, you can also jar the contents of non-gwt--project, ensure that you include the source in the jar, and then include the jar in gwt-project's classpath.

Good Luck!

这篇关于Eclipse 3.4 GWT 1.6项目 - 如何从其他项目引用源?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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