如何在一个应用程序中使用一个gwt应用程序的源代码 [英] How to use source code of one gwt application in to another application
问题描述
我有两个不同的gwt项目,并且希望将一个gwt应用程序的类用于另一个模块。有没有办法做到这一点?
我遵循下面的方法,在第二个项目中添加了两行以下
< inherits name =com.yellowbook.mdb.NationalResidential/>
< source path ='com.yellowbook.mdb'/>
但我收到以下错误:
无法在你的类路径中找到'com / yellowbook / mdb / NationalResidential.gwt.xml';可能是拼写错误,或者您可能忘记为源代码包含类路径条目?
是否错过了这里的任何内容?
如果您想将一个项目应用到另一个项目中,那么以下是一些可能的方法: 第一种方法 h1>
如果您使用两个项目作为单独的模块,即 GWT模块,那么你可以为通用代码创建一个包结构,并将条目添加到gwt.xml文件中。
ProjectModule1.gwt.xml
< source path ='共享/>
ProjectModule2.gwt.xml
< source path ='shared'/>
第二种方法
项目,然后
开发中:
-
另外,如果你使用eclipse,构建发展之路
<
< inherits name ='com.project2'/ > //同样用于项目1
制作中:
b $ b- 您需要为这两个项目创建一个jar并添加到classpath中。
但是如果你使用第二种方法,那么这不是一个很好的方法,因为当你想要加载一个project1,然后project2自动加载和不必要的JavaScript将加载,所以更好地使用模块方法,或者创建第三个项目项目1& project2并在两个项目中使用它。
I have two different gwt projects, and want to use classes of one gwt application in to an another module. Is there any way to do that?
I followed the below approach, added below two lines in the second project
<inherits name="com.yellowbook.mdb.NationalResidential"/>
<source path='com.yellowbook.mdb' />
but i am getting the following error:
Unable to find 'com/yellowbook/mdb/NationalResidential.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?
did i miss any thing here?
If you want to use a one project into another one, then following are some of possible ways:
First approach
If you are using two projects as a separate module i.e. GWT Module, then you can create a package structure for common code and add entry into gwt.xml file.
ProjectModule1.gwt.xml
<source path='shared'/>
ProjectModule2.gwt.xml
<source path='shared'/>
Second approach
If you created separate project for this, then
In development:
Add module entry in gwt.xml file, i.e.
<inherits name='com.project2'/> //same for project 1
Also if you working with eclipse, then add required project in build path for development
In Production:
- You need to create a jar and add to classpath for both the project.
But if you go with second approach, then it is not a very good approach, because when you want to load a project1 then project2 auto load and unnecessary javascript will load, so better to use module approach, or create a third project which has a common code of project1 & project2 and use it in both projects.
这篇关于如何在一个应用程序中使用一个gwt应用程序的源代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!