Missing maven dependencies from deployment assembly

35,152

Solution 1

This should have nothing to do with eclipse and m2eclipse, and optionally for better support - m2e-wtp. Also, you don't need copy-dependencies. Here are a few possible reasons:

  • you should invoke mvn package (or right-click > maven > package) and obtain a war file - the (in the pom) must be war

    <packaging>war</packaging>

  • your dependencies should be with the default scope (if they are provided or test they will not be included in the archive)

  • if you are running the project as dynamic web project on a server within eclipse, then you should open the project properties (right click > properties) and select "Deployment Assembly". There click "add", select "build path entries", and choose "maven dependencies". This will instruct WTP to send the maven dependencies to the server dir.

Solution 2

can you please try to cleanse setup by following below steps

  1. disable Maven nature of application :

Right Click Project -> Maven -> Disable Maven Nature

  1. open cmd , go to project location , Run mvn clean install eclipse:eclipse -Dwtpversion=2.0(This goal just deletes the .project, .classpath and .settings/ files/directories. You can also just remove those files (again while the project is open) instead of running mvn eclipse clean.)

  2. Re-enable the maven nature. (Most of the time, this can be done by right-clicking on the project in question in the package explorer pane, and then choosing 'Configure'-> 'Convert to Maven Project')

other things you can try of

1. reimport project into some other workspace 
2. resintall eclipse 

if it still didn't solve your problem , most probably you might need to raise Jira to eclipse team .

Solution 3

I solved a similar issue by doing following actions on my web project:

  • removing maven nature
  • cleaning up all m2e generated files
  • adding maven nature
  • alt + F5

Note : I had this issue after adding maven nature to my java projects in order to use them with m2e instead of prior maven eclipse plugin (legacy...)

Solution 4

I solved the same issue this way:

  1. Open pom.xml and make Packaging war .
  2. Right click the project and select Maven>Update Project.

Will update the project without deleting the Maven Dependencies from Deployment Assembly ; And if the Maven Dependencies is missing the Maven>Update Project will automatically add it to the project Deployment Assembly

Solution 5

I recently had the same issue just like your description above and I got it working this way:

  1. right-click on project > Maven > Disable Maven Nature
  2. right-click on project > Configure > Convert to Maven Project

Then call the Maven update project, the Maven dependencies will not disappear from the view of Deployment Assembly again.

Share:
35,152

Related videos on Youtube

Jan Krakora
Author by

Jan Krakora

Updated on March 28, 2020

Comments

  • Jan Krakora
    Jan Krakora over 4 years

    I've recently upgraded from eclipse 4.4.2 (Luna) to 4.5 (Mars). My dynamic web project now doesn't include the Maven Dependencies in its deployment assembly "Project->Properties->Deployment assembly".

    I can add them manually (using "Project->Properties->Deployment assembly->Add->Java Build Path Entries->Maven Dependencies"), but every time I run "Project->Maven->Update Project Configuration", the Maven Dependencies are removed again.

    Note that I run the project using the Apache Tomcat Server within the Eclipse IDE.

    I have installed

    • m2e 1.6.0.20150526-2032
    • m2e-wtp 1.2.0.20150602-1740
    • cyfur01
      cyfur01 almost 9 years
      Do you have the Google plugin for Eclipse installed? If so, you might be running into this issue.
    • Jan Krakora
      Jan Krakora over 8 years
      @cyfur01 No, I don't. But all symptoms seem similar.
    • DEWA Kazuyuki - 出羽和之
      DEWA Kazuyuki - 出羽和之 almost 6 years
      probably same on official issue tracker: bugs.eclipse.org/bugs/show_bug.cgi?id=462591
  • Jan Krakora
    Jan Krakora about 9 years
    Thanks for your response but as I wrote in my question, I tried to add Maven Dependencies using 'Add' in Deployment Assembly. It works but only until I run Maven->Update Project. Then it disappears again...
  • Jebil
    Jebil almost 9 years
    @Behnil as in my first point, is <packaging>war</packaging> there in your pom.xml ? Also the scope of the dependencies ?
  • Jan Krakora
    Jan Krakora almost 9 years
    Yes, it is. The application has been working fine for 2 years until I switched to the Eclipse Mars. I think the m2e-WTP ignores it's a maven project or something.
  • Jan Krakora
    Jan Krakora almost 9 years
    Actually I clone my GIT repo from scratch as well I create a new workspace directory for the Eclipse. Then I run "Import Maven Projects..." from Git Repositories view. Note that my repo doesn't contain any eclipse related files, so they have been generated - ie they should be fine. Anyway I will try it.
  • Jan Krakora
    Jan Krakora over 8 years
    I've just tried. But the Maven Dependencies disappeared again.
  • Patrick He
    Patrick He over 8 years
    Thanks for your notice. Please check the setting: <installed facet="jst.web" version="3.0"/> inside org.eclipse.wst.common.project.facet.core.xml within .settings folder, the jst.web version should be the same as the web-app version in web.xml header : <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
  • Jan Krakora
    Jan Krakora over 8 years
    I've found <installed facet="jst.web" version="2.5"/> and yes, it's the same as web-app version in web.xml header.
  • zb226
    zb226 over 8 years
    In my case, the missing <packaging>war</packaging> was indeed the culprit.
  • hbobenicio
    hbobenicio about 7 years
    Why do we need to setup this manually? Shouldn't this be m2e-wtp's job? (configure eclipse projects and m2e to deploy maven projects as it is specified by pom.xml). Maven Update feature should care about adding Maven Dependecies to the Deployment Assembly, I'm point of view. Is something missing or misconfigurated in my pom.xml which breaks m2e-wtp anyhow? It should let me know what it is then, if this is the case. m2e-wtp just seems too buggy for me...
  • Alex R
    Alex R about 5 years
    Thanks for the hint, I just disabled workspace resolution and the Maven dependencies magically reappeared in the deployment assembly... I could enable again without adverse effect