Eclipse – Maven project in eclipse – deployment assembly fails build

deploymenteclipsemaven

Sorry for being verbose…

I have some existing maven projects. I imported them into Eclipse using Maven -> Import existing Maven projects.

This gave me 6 individual projects and one project which lists all 6 under it. (The umbrella project has 6 modules defined in it which translated to 6 eclipse project – as I understand how maven works)

One of the project A requires two other project B and C (at compile time and run-time).

Build path –
On the build path of A I have one of the libraries as Maven dependencies. And it builds fine.

Deployment assembly –
On the deployment assembly of A however there is no entry for deploy to web-inf/lib. Because of that when tomcat starts it doesn't find any required jars or the project B and C.
So I added an entry to deployment assembly as : source – maven And dependencies deploy – web-inf/lib.
Tomcat comes up and my webapp for project A comes up.

This however breaks the eclipse build – upon build eclipse complains:
"Invalid classpath publish export Project entries not supported"

This I see is because, under build path, there is new entry added to web-inf/lib to publish/export under maven-dependencies. Removing that removes maven entry from the deployment assembly as well.

The only workaround is that in the deployment assembly I specify the web-inf/lib under target generated by maven but that causes stale copies of project B and C to be picked up.

Why I need this setting is because when I make changes to project B and C in Eclipse and build them in Eclipse I want to see the changes when I am debugging project A. I don't want to run maven builds on B and C again since its time consuming.

Any help is much appreciated.

I did try including the MAVEN2_CLASSPATH_CONTAINER but that is always empty and when tomcat runs it cannot find the necessary libraries. (BTW what vale is the MAVEN2_CLASSPATH_CONTATINER set to?)

This is on Eclipse Indigo Mac OSX.

Best Answer

You need to add the relevant project/s to your Deployment Assembly.

Right Click Project -> Properties -> Deployment Assembly -> Add