简体   繁体   English

引用项目中的源未部署到Eclipse中的Tomcat

[英]Sources from referenced projects are not deployed to Tomcat in Eclipse

I have setup a dynamic web project in eclipse with JSF in which I trust on code from another project (framework). 我在eclipse中使用JSF设置了一个动态Web项目,我相信其他项目(框架)的代码。 Therefore, I added the framework project to the build path of the website project. 因此,我将框架项目添加到网站项目的构建路径中。

So far so good, Eclipse recognises every class and the project builds without errors. 到目前为止,Eclipse很好地识别了每个类,并且项目构建没有错误。

Problem is though that when I do "run on server" to test it on tomcat 6.0.24, the application fails. 问题是当我在“运行服务器上”在tomcat 6.0.24上测试它时,应用程序失败了。 I get ClassNotFoundException on every class from the framework project. 我从框架项目的每个类上得到ClassNotFoundException。

Is this a bug or is some specific configuration necessary for this? 这是一个错误还是一些必要的配置?

I was googling and ended up here for a similar problem. 我在Google上搜索并最终在这里遇到了类似的问题。 I wanted to make a note for others about the current situation on Eclipse Indigo, as the terminology has changed a bit by the looks of things. 我想为其他人做一个关于Eclipse Indigo当前情况的说明,因为术语已经改变了一些东西。

On your project properties, do a filter/search for "deployment assembly". 在项目属性上,执行过滤/搜索“部署程序集”。

It is then straightforward to add a project dependency. 然后,直接添加项目依赖项。 Job Done. 任务完成。

Thanks to Alexander's edited answer which led me to this. 感谢亚历山大编辑的答案,这让我想到了这一点。

Did you check Warnings in Problems view? 你检查了Problems视图中的警告吗?

Do you see Classpath entry /your/framework.jar will not be exported or published. Runtime ClassNotFoundExceptions may result 您是否看到Classpath entry /your/framework.jar will not be exported or published. Runtime ClassNotFoundExceptions may result Classpath entry /your/framework.jar will not be exported or published. Runtime ClassNotFoundExceptions may result warning? Classpath entry /your/framework.jar will not be exported or published. Runtime ClassNotFoundExceptions may result警告?

If you do. 如果你这样做。

  1. Right-Click the warning and choose Quick Fix . 右键单击警告,然后选择“ Quick Fix
  2. Choose "Mark the associated entry as publish/export dependency." 选择“将关联的条目标记为发布/导出依赖项”。 from Select a Fix box. Select a Fix框。
  3. Click Finish . 单击Finish

EDIT 编辑
Now, I think I understand where disconnect is. 现在,我想我明白断开连接的地方。 I think now I remember the joy of figuring this out for the first time. 我想现在我记得第一次想到这个的乐趣。

In your website project ( I will speculate here , but I guess you've created it as a Dynamic Web Project ): 在您的网站项目中(我将在此推测,但我猜您已将其创建为Dynamic Web Project ):

  1. Open project properties 打开项目属性
  2. Select Java EE Module Dependencies panel 选择“ Java EE Module Dependencies面板
  3. Check your framework project in JAR/Module column. 检查JAR/Module列中的框架项目。 Beware, that for reasons not known to me, the list is not sorted ( and is not sortable ) in any particular order, so you may need to search for your project reference there. 请注意,由于我不知道的原因,列表没有按任何特定顺序排序(并且不可排序),因此您可能需要在那里搜索项目参考。

The results of this operation will be written to /website-project/.settings/org.eclipse.wst.common.component file. 此操作的结果将写入/website-project/.settings/org.eclipse.wst.common.component文件。 Put this file into your source control. 将此文件放入源代码管理中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我的Web应用程序部署在哪里(从Eclipse到Tomcat 7) - Where is my webapp deployed(From Eclipse to Tomcat 7) Eclipse未部署引用的库 - Referenced libraries not being deployed by Eclipse 支持Eclipse maven的Web应用程序引用工作区项目,但在运行Tomcat服务器时未部署这些项目 - Eclipse maven-enabled web app references workspace projects, but those are not deployed when running Tomcat server 404与tomcat / eclipse部署的Webapp - 404 with tomcat / eclipse deployed webapp 将引用的Eclipse项目添加到Maven依赖项 - Adding referenced Eclipse projects to Maven dependencies 使用Tomcat和Eclipse部署的网站的地址 - An address of a website deployed using Tomcat and Eclipse Eclipse Tomcat Server启动,但代码未部署 - Eclipse Tomcat Server starting but code is not getting deployed 如何在Tomcat中部署的Eclipse中调试Java应用程序? - How to debug java application in Eclipse deployed in tomcat? 从2.9升级到2.10后,Scala eclipse-plugin引用项目的非托管依赖项不在classpath上 - Scala eclipse-plugin Project unmanaged dependencies of referenced projects not on classpath after upgrade from 2.9 to 2.10 Eclipse RCP-在工作区中的项目中放置javadocs和相关依赖源 - Eclipse RCP - Shere javadocs and attached sources of dependencies among projects in workspace
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM