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

907 views Asked by At

I have a web application (Eclipse's Dynamic Web App) which uses Maven (m2e-wtp) for the build and dependencies management. 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.

Everything works fine when I run maven from the CLI. All dependencies are included in the WEB-INF/lib directory just as expected.

The problem is when I attempt to run the project using 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.

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. I read in a few places that we should not manually add entries there since all dependencies should be managed by 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?

I'm using 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. 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...

UPDATE: The workspace projects I added as dependencies in the POM appear in the list of Referenced Projects, under the project's properties. But when I expand the Maven Dependencies in the Project Explorer, the workspace project dependencies are missing from the list! Only the ones in the Maven repository show up. They local ones seem to be silently ignored...

1

There are 1 answers

0
cleuton On

I had similar problem because I created the project outside eclipse, and them imported it. What worked for me was to add the right project facet: Project context menu -> properties -> Project Facets -> Dynamic Web Module (choose right version). 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.