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

17

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

Trinitarianism answered 15/9, 2014 at 8:12 Comment(0)
I
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)
Implosion answered 27/12, 2014 at 5:30 Comment(2)
I didn't need to install m2e-wtp in my case, your second step fixed my issue.Sestos
Thanks. m2e-wtp was already installed on my Eclipse. I just followed your second step and it worked.Cherriecherrita
I
12

Just had this happen on Mars.

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

Infrared answered 3/6, 2016 at 14:30 Comment(1)
@Thomas, how did you do it? I am having the same problem.Cherriecherrita
W
9

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

Whittling answered 6/7, 2016 at 19:50 Comment(0)
C
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.

Crifasi answered 28/11, 2014 at 15:39 Comment(0)
E
4

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

Entelechy answered 12/6, 2015 at 3:8 Comment(1)
Similar problem. Forgot to enable "Build Automatically"Protozoal
A
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...

Absentee answered 13/7, 2017 at 14:26 Comment(0)
P
2

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

Platinic answered 23/7, 2015 at 10:11 Comment(1)
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.Ambulatory
C
1

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

Cavite answered 31/1, 2017 at 11:55 Comment(0)
L
1

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

Lotic answered 4/4, 2017 at 7:26 Comment(0)
H
1

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

Hearst answered 4/10, 2017 at 9:39 Comment(0)
U
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

Usually answered 10/12, 2014 at 13:35 Comment(0)
P
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.

Pontonier answered 24/5, 2016 at 11:57 Comment(0)
G
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.

Gowon answered 11/5, 2017 at 9:0 Comment(0)
N
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

Neper answered 7/6, 2017 at 4:10 Comment(0)
P
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.

Polyglot answered 10/7, 2017 at 13:3 Comment(0)
P
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!

Pronuba answered 18/1, 2021 at 23:29 Comment(0)
F
-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!

Fickle answered 18/1, 2016 at 23:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.