开发者

Maven project in eclipse - deployment assembly fails build

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 an开发者_运维知识库d 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.


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

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


I solved just doing this:

right click on my eclipse project-> Maven -> Update Project Configuration...


Figured it out ..but not completely...

So I added maven dependency in the deployment assembly as I mentioned earlier.

Maven dependency -> WEB-INF/lib

AND additionally added project B and C as well :

B -> WEB-INF/lib and C->WEB-INF/lib

Somehow this way B and C are not added to the publish/export in the java build path. I don't know how eclipse knows to not export B and C from maven repo but to export it from project B and C itself.

Anyways thats for some other day.. for now i m happy :)


For anyone else that searches for this, it seems that you can also manually add the following to the .classpath file

<classpathentry combineaccessrules="false" kind="src" path="/B"/>


By including Maven Dependencies, you are including dependencies for project B and project C. It turns out, you also have to include project B and C manually.

The exact fix which works is. project A -> properties -> Deployment Assembly

Click Add and then Project. Select B and C. Problem will get fixed after rebuilding.


I had this problem, but I believe none of these answers correctly fix the problem. Instead they workaround m2eclipse (which should manage classpaths and deployment assembly for you). For me, the problem that I was using m2eclipse without m2eclipse-wtp (a separate plugin).

See this SO answer for the plug-in details.


You can add the relevant projects / or maven java build path entry if using maven to your Deployment assembly (project -> properties -> deployment Assembly)

Then checks if theses relevant project are Facets compatible. (project -> Project Facets)


This error can occur if you have multiple entries of same jar in you class path. So you need to check your classpath and remove duplicate entries.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜