简体   繁体   English

支持Eclipse maven的Web应用程序引用工作区项目,但在运行Tomcat服务器时未部署这些项目

[英]Eclipse maven-enabled web app references workspace projects, but those are not deployed when running Tomcat server

I have a web application (Eclipse's Dynamic Web App) which uses Maven (m2e-wtp) for the build and dependencies management. 我有一个Web应用程序(Eclipse的动态Web应用程序),它使用Maven(m2e-wtp)进行构建和依赖项管理。 This web app's POM references a few other projects in my workspace, which happen to be eclipse plugins built with maven as well (built using Tycho), and also other third party libraries which come from Maven's repository. 这个Web应用程序的POM引用了我工作区中的一些其他项目,这些项目恰好是使用maven构建的eclipse插件(使用Tycho构建),以及来自Maven存储库的其他第三方库。

Everything works fine when I run maven from the CLI. 当我从CLI运行maven时,一切正常。 All dependencies are included in the WEB-INF/lib directory just as expected. 所有依赖项都按预期包含在WEB-INF / lib目录中。

The problem is when I attempt to run the project using Eclipse. 问题是当我尝试使用Eclipse运行项目时。 I run the app in a configured Tomcat server inside Eclipse, but the referenced projects in my workspace are not added to the deployed war. 我在Eclipse中配置的Tomcat服务器中运行应用程序,但我工作区中引用的项目未添加到已部署的war中。

I tried adding them to the Deployment Assembly (under project preferences), and that works perfectly, but those settings get wiped out by m2e every time the maven configurations are updated. 我尝试将它们添加到部署程序集(在项目首选项下),并且完美地工作,但每次更新maven配置时,m2e都会清除这些设置。 I read in a few places that we should not manually add entries there since all dependencies should be managed by m2e... 我在几个地方读到我们不应该手动添加条目,因为所有依赖项都应该由m2e管理...

The question is: How to make Eclipse add the workspace project dependencies to the WEB-INF/lib of my web app when I run it from Eclipse? 问题是: 当我从Eclipse运行时,如何让Eclipse将工作区项目依赖项添加到我的Web应用程序的WEB-INF / lib中?

I'm using Eclipse J2EE 4.3.1 (Kepler SR1). 我正在使用Eclipse J2EE 4.3.1(Kepler SR1)。

I also tried right-clicking the project and selecting Export -> WAR file, but the exported WAR file doesn't include the referenced workspace projects either. 我还尝试右键单击项目并选择Export - > WAR file,但导出的WAR文件也不包括引用的工作区项目。 I'm assuming the issue is affecting both cases. 我假设这个问题影响了两个案例。

This is extremely annoying ans is slowing me down quite a bit.. at this time I have to re-add the projects to the Deployment Assembly page several times a day to keep it going... 这非常令人讨厌,而且让我慢慢减速......此时我必须每天多次将项目重新添加到Deployment Assembly页面以保持它...

UPDATE: The workspace projects I added as dependencies in the POM appear in the list of Referenced Projects, under the project's properties. 更新:我在POM中作为依赖项添加的工作空间项目出现在项目属性下的Referenced Projects列表中。 But when I expand the Maven Dependencies in the Project Explorer, the workspace project dependencies are missing from the list! 但是,当我在Project Explorer中展开Maven依赖项时,列表中缺少工作区项目依赖项! Only the ones in the Maven repository show up. 只显示Maven存储库中的那些。 They local ones seem to be silently ignored... 他们当地人似乎默默地被忽视了......

I had similar problem because I created the project outside eclipse, and them imported it. 我有类似的问题,因为我在eclipse之外创建了项目,并且他们导入了它。 What worked for me was to add the right project facet: Project context menu -> properties -> Project Facets -> Dynamic Web Module (choose right version). 对我有用的是添加正确的项目方面:项目上下文菜单 - >属性 - >项目构面 - >动态Web模块(选择正确的版本)。 I was using Eclipse ADT (version 4.2.0), but, to avoid having multiple installations, I use the same eclipse for Android and other kind of apps. 我使用的是Eclipse ADT(版本4.2.0),但是,为了避免多次安装,我对Android和其他类型的应用程序使用相同的eclipse。

暂无
暂无

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

相关问题 Apache Tomcat和Apache TomEE服务器未在Eclipse中运行Web项目 - Apache Tomcat and Apache TomEE server is not running web projects in eclipse Web应用程序在带有Glassfish 4.1的Eclipse中可以正常工作,但在部署到Tomcat 9时不能正常工作 - Web app works fine in Eclipse with Glassfish 4.1 but not when deployed to Tomcat 9 在 Eclipse 中的 Tomcat 7 上运行 Jersey Web 应用程序时出现 404 错误 - 404 error when running Jersey web app on Tomcat 7 in Eclipse 通过Eclipse运行Web项目时出错(已部署到tomcat) - Error in running a Web project via Eclipse (deployed to tomcat) 在Eclipse上运行动态Web项目会在Tomcat 7中引发404错误 - Running dynamic web projects on Eclipse brings up a 404 error in Tomcat 7 引用项目中的源未部署到Eclipse中的Tomcat - Sources from referenced projects are not deployed to Tomcat in Eclipse 在Mac上使用Tomcat 8在Eclipse中运行Web应用程序的问题 - Issue running Web app in eclipse with tomcat 8 on mac 使用Maven Eclipse和Tomcat Server设置RESTFull Web应用程序项目 - Setting up RESTFull web app project using Maven Eclipse and Tomcat Server 使用 Tomcat 部署 Eclipse Web 应用程序:提供多个项目的依赖项? - Eclipse Web-App Deployment with Tomcat: Providing multiple projects' dependencies? 使用Maven构建的Java Spring Boot Web App(Hello World)在运行时无法启动Tomcat - Java Spring Boot Web App(hello world) building with Maven fails to start Tomcat when running
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM