28

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

Muhammad Gelbana
  • 3,890
  • 3
  • 43
  • 81

17 Answers17

14

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)
Tharaka
  • 2,883
  • 1
  • 21
  • 13
  • 3
    I didn't need to install m2e-wtp in my case, your second step fixed my issue. – FBB Mar 03 '15 at 20:34
  • Thanks. m2e-wtp was already installed on my Eclipse. I just followed your second step and it worked. – NixRam Jul 30 '17 at 11:35
12

Just had this happen on Mars.

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

Thomas Nicol
  • 141
  • 1
  • 7
9

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

Nico Gallegos
  • 321
  • 8
  • 20
4

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.

Michael
  • 7,348
  • 10
  • 49
  • 86
4

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

BDL
  • 21,052
  • 22
  • 49
  • 55
robertant
  • 98
  • 7
3

Just spend a couple of hours trying every solution described in this lengthy thread... Nothing worked until I discovered something hidden in the preferences...

The solution was simple: Preferences -> Maven -> Java EE Integration -> Enable Java EE configuration

Why it was disabled in the first place will always be a mystery to me...

DeZeppe
  • 31
  • 1
2

I had this issue using Weblogic. I went to (project)/target/m2e-wtp and manually created the web-resources folder.

Jason
  • 3,943
  • 12
  • 64
  • 104
  • 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. – nagylzs Dec 17 '17 at 05:39
1

I had the same problem and I could solve it by adding <packaging>war</packaging> to my pom.xml file in project tag.

M. Chavoshi
  • 1,023
  • 9
  • 17
1

Need to update maven project >right click on project >click Maven>Update project.

Ganesh Giri
  • 1,135
  • 11
  • 18
1

goto Windows menu>preference>choose Maven>Java EE Integration>uncheck the WAR project Preferences()

0

Hey I'm also facing a similar issue and I just addeed as discribed above by using this configuration bellow: Configure >> Add Projects Archives Support

0

I had this issue and none of the other answers worked for me. I resolved it by right-clicking on the project in Package Explorer and choosing Build Project. This caused the missing m2e-wtp folder to appear.

Conor Pender
  • 1,071
  • 1
  • 14
  • 30
0

I am using linux mint and i found in ~.m2/repository ".lock" file 1- I removed it. 2- I run maven clean and it worked with me.

Note: This is my solution for many issues with maven, cause ".lock" prevent maven from doing work on disk. so i hope it help you in many other issues.

0

Nothing wrong with the tomcat plugin or the application, it only needed a refresh once in a while. Also, because maven was cleaning up target. I just had to setup my maven build to also refresh the project including target folder.

Check the option to automatically refresh resources in your maven build

kisna
  • 2,869
  • 1
  • 25
  • 30
0

1) I have fixed by deleting the lock folder from the ~.maven/repository ".lock" folder.
2) Open project preferences -> Project Facets -> Runtimes -> Select the runtime of your choice.
3) Need to update maven project >right click on project >click Maven>Update project.

Thats it, the problem is resolved for me.

ramesh027
  • 796
  • 1
  • 10
  • 27
0

There are a couple of things to try..

  1. Like Tharaka suggested .. Install m2e-wtp from eclipse marketplace (if it's not already installed)

After this, try doing the following in sequence. One or more of these could help resolve your issue. I am using the latest Eclipse(4.18).

  1. Right click Project-> Properties -> DeploymentAssembly -> Remove /target/m2e-wtp/web-resources folder. Clean Project and run again.

  2. If no luck try this, Open project preferences -> Project Facets -> Runtimes -> Select the runtime of your choice. Ensure it's compatible with the JDK, JRE version you use. (I am using Tomcat 9 for JDK 11, JRE11)

  3. Still no luck, Right click Project -> Run As -> Maven Clean. Followed by Maven Install.

  4. Do steps 2,3,4 and clean the project and run on server again.

If this helps, do give an upvote! Thanks!

-1

This due to a conflict between m2e-wtp & m2e plugin in eclipse . Uninstall the m2e plugin as it is already included as part of your m2e-wtp plugin. Restart and voila!