Maven does not create the "/target/m2e-wtp/web-resources" folder

47,744

Solution 1

I was struggling with the same issue for a couple of days. Ultimately the following steps worked for me.

  • Install m2e-wtp from eclipse marketplace (if it's not already installed)
  • Open Project Preferences -> Project Facets -> Runtimes -> Select the runtime of your choice (Tomcat 7 in my case)

Solution 2

Just had this happen on Mars.

Fixed it by disabling the Dynamic Web Module facet and then re-enabling it.

Solution 3

Got the same issue. I solved it removing the "/target/m2e-wtp/web-resources" under Deployment Assembly. Then Maven -> Update Project.

Solution 4

Disabling the Build Automatically option and building manually again worked for me.

Solution 5

Eclipse (Luna) will only generate the Maven Archiver files under the build path (in /target/m2e-wtp/web-resources) if it considers the project to be a "WAR Project".

From experience, this seems to be any project with the Dynamic Web Module facet. If the project is already a Faceted Form project, add the facet and build your project. If not, choose the [Configure -> Convert to Faceted Form...] menu option and go from there.

For projects imported as "Existing Maven Projects", Eclipse will usually set this for you. But if you've just checked the project out of version control or created / imported the project as a "standard" Java project, it may not have done.

Share:
47,744

Related videos on Youtube

Muhammad Gelbana
Author by

Muhammad Gelbana

I bare witness there is no god but Allah, and Muhammad is his final prophet and messenger I'm a Muslim Egyptian Java developer. I have great passion for Java software development. I don't believe there is something known as a bad question. A question needs to be answered.

Updated on July 09, 2022

Comments

  • Muhammad Gelbana
    Muhammad Gelbana almost 2 years

    I'm using Eclipse Luna. I'm working on a Maven project. When I try to run my application on a weblogic's application server, and exception is thrown with the message:

    weblogic.application.ModuleException: [HTTP:101027][WebAppModule(_auto_generated_ear_:MyAppName)] Document root: "D:\MGelbana\workspace\my-app-name\target\m2e-wtp\web-resources" does not exist.
    

    I looked into the project's deployment assembly configuration and found the following error message: Cannot find entry: "/target/m2e-wtp/web-resources"

    enter image description here

    So I thought Luna's default Maven installation isn't what I need to I uninstalled it and I installed M2E-WTP from this URL (http://download.eclipse.org/m2e-wtp/releases/luna/) but I believe I ended up with the same version and same options.

    I understand that this plugin has the option of generating this folder /target/m2e-wtp/web-resources which helps Eclipse to deploy an application into an application server (Run on server option)

    (Which is my end goal but I'm having issues with deploying the application with it's needed dependencies. If I generate the application's WAR file by Installing the maven project and deploying the generated that WAR manually, the application works, but I need to be able to debug\run it on the application server using Eclipse.)

    But this folder (i.e. /target/m2e-wtp/web-resources) isn't created !

    In Eclipse's Maven > Java EE Integration > WAR project preferences > Maven archiver generated files under the build directory (I checked this option)

    In the project-specific options, I only have a Maven menu and a Lifecycle mapping sub-menu and nothing to do with the maven archiver generating files or not !

    So how can I direct maven to output the WTP related files ?

    enter image description here

  • FBB
    FBB over 9 years
    I didn't need to install m2e-wtp in my case, your second step fixed my issue.
  • kolobok
    kolobok about 8 years
    Similar problem. Forgot to enable "Build Automatically"
  • NixRam
    NixRam almost 7 years
    @Thomas, how did you do it? I am having the same problem.
  • NixRam
    NixRam almost 7 years
    Thanks. m2e-wtp was already installed on my Eclipse. I just followed your second step and it worked.
  • nagylzs
    nagylzs over 6 years
    After creating this directory, don't forget to do maven update, then clean/build, then go to project / deployment assemly, and check that /target/m2e-wtp/web-resources has deploy path=/. Finally, if you see a warning message saying that "maven2_classpath_container will not be exported" then select that warning message, press Ctrl+1 and mark it as exported.