Maven不创建“/target/m2e-wtp/web资源”文件夹

时间:2021-11-05 10:43:39

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:

我使用Eclipse Luna。我正在做一个Maven项目。当我试图在weblogic的应用服务器上运行应用程序时,会抛出以下消息:

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"

我查看了项目的部署程序集配置,发现以下错误消息:找不到条目:“/target/m2e-wtp/web资源”

Maven不创建“/target/m2e-wtp/web资源”文件夹

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.

因此,我认为Luna的默认Maven安装不是我需要的,我卸载了它,并从这个URL (http://download.eclipse.org/m2e-wtp/releases/luna/)安装了M2E-WTP,但我相信我最终得到了相同的版本和相同的选项。

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)

我理解这个插件可以生成这个文件夹/目标/m2e-wtp/web资源,它可以帮助Eclipse将应用程序部署到应用服务器(运行在服务器上)

(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.)

(这是我的最终目标,但我在部署应用程序时遇到了需要依赖项的问题。如果我通过安装maven项目并手动部署生成的WAR来生成应用程序的WAR文件,那么这个应用程序可以工作,但是我需要能够使用Eclipse在应用服务器上调试\运行它)。

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

但是这个文件夹(例如/target/m2e-wtp/web资源)没有创建!

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

在Eclipse的Maven > Java EE集成> WAR项目首选项> Maven归档程序中,在构建目录下生成文件(我选中了这个选项)

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 !

在特定于项目的选项中,我只有一个Maven菜单和一个生命周期映射子菜单,与Maven归档文件生成文件没有任何关系!

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

那么如何指导maven输出与WTP相关的文件呢?

Maven不创建“/target/m2e-wtp/web资源”文件夹

16 个解决方案

#1


9  

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

我为同样的问题挣扎了几天。最终,跟随别人对我起了作用。

  • Install m2e-wtp from eclipse marketplace (if it's not already installed)
  • 从eclipse市场安装m2e-wtp(如果还没有安装的话)
  • Open project preferences -> Project Facets -> Runtimes -> Select the runtime of your choice (Tomcat 7 in my case)
  • 开放项目首选项->项目facet ->运行时->选择您选择的运行时(在我的例子中是Tomcat 7)

#2


9  

Just had this happen on Mars.

这一切就发生在火星上。

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

通过禁用动态Web模块facet来修复它,然后重新启用它。

#3


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".

如果将项目视为“战争项目”,Eclipse (Luna)只会在构建路径(in /target/m2e-wtp/web资源)下生成Maven Archiver文件。

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.

从经验来看,这似乎是任何具有动态Web模块方面的项目。如果项目已经是一个多面的表单项目,那么添加facet并构建项目。如果不是,选择[配置->转换为面形…菜单选项,然后从那里开始。

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.

对于作为“现有Maven项目”导入的项目,Eclipse通常会为您设置这个。但是,如果您只是在版本控制之外检查了项目,或者将项目作为“标准”Java项目创建/导入,那么它可能还没有完成。

#4


3  

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

自动禁用构建选项并手工构建再次对我起作用。

#5


2  

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

我用Weblogic解决了这个问题。我去了(project)/target/m2e-wtp,手工创建了web资源文件夹。

#6


2  

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

有同样的问题。我解决了在部署程序集中移除“/target/m2e-wtp/web资源”的问题。然后是Maven ->更新项目。

#7


2  

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

我遇到了同样的问题,我可以通过在pom中添加 war 来解决。项目标记中的xml文件。

#8


2  

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

需要更新maven项目>右键点击项目>点击maven >更新项目。

#9


1  

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

goto窗口的菜单>偏好>选择Maven>Java EE集成>uncheck战争项目偏好()

#10


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

嘿,我也面临着一个类似的问题,我只是通过使用这个配置bellow: Configure >>添加项目档案支持在上面描述

#11


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.

我有这个问题,其他的答案对我都不起作用。通过在Package Explorer中右键单击项目并选择Build project,我解决了这个问题。这导致丢失的m2e-wtp文件夹出现。

#12


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.

我正在使用linux mint,我在~中找到了。m2 /库”。锁定“文件1-我删除了它。2-我运行maven clean,它和我一起工作。

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.

注意:这是我对maven的许多问题的解决方案。锁定“防止maven在磁盘上工作。所以我希望它能在其他很多问题上帮助你。

#13


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.

tomcat插件或应用程序没有问题,它只是偶尔需要一次刷新。另外,因为maven正在清理目标。我只需要设置我的maven构建来刷新包含目标文件夹的项目。

Check the option to automatically refresh resources in your maven build

检查选项以自动刷新maven构建中的资源

#14


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.

1)我已经修复了从~中删除锁文件夹。maven /库”。锁”文件夹。2) Open project preferences -> project facet -> Runtimes ->选择您所选择的运行时。3)需要更新maven项目>右键点击项目>点击maven >更新项目。

Thats it, the problem is resolved for me.

就是这样,问题为我解决了。

#15


0  

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

解决方案很简单:首选项—> Maven—> Java EE集成—>支持Java EE配置

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

为什么它一开始就有缺陷,这对我来说一直是个谜……

#16


-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!

这是由于eclipse中m2e-wtp和m2e插件之间的冲突造成的。卸载m2e插件,因为它已经包含在m2e-wtp插件中。重启了,瞧!

#1


9  

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

我为同样的问题挣扎了几天。最终,跟随别人对我起了作用。

  • Install m2e-wtp from eclipse marketplace (if it's not already installed)
  • 从eclipse市场安装m2e-wtp(如果还没有安装的话)
  • Open project preferences -> Project Facets -> Runtimes -> Select the runtime of your choice (Tomcat 7 in my case)
  • 开放项目首选项->项目facet ->运行时->选择您选择的运行时(在我的例子中是Tomcat 7)

#2


9  

Just had this happen on Mars.

这一切就发生在火星上。

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

通过禁用动态Web模块facet来修复它,然后重新启用它。

#3


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".

如果将项目视为“战争项目”,Eclipse (Luna)只会在构建路径(in /target/m2e-wtp/web资源)下生成Maven Archiver文件。

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.

从经验来看,这似乎是任何具有动态Web模块方面的项目。如果项目已经是一个多面的表单项目,那么添加facet并构建项目。如果不是,选择[配置->转换为面形…菜单选项,然后从那里开始。

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.

对于作为“现有Maven项目”导入的项目,Eclipse通常会为您设置这个。但是,如果您只是在版本控制之外检查了项目,或者将项目作为“标准”Java项目创建/导入,那么它可能还没有完成。

#4


3  

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

自动禁用构建选项并手工构建再次对我起作用。

#5


2  

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

我用Weblogic解决了这个问题。我去了(project)/target/m2e-wtp,手工创建了web资源文件夹。

#6


2  

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

有同样的问题。我解决了在部署程序集中移除“/target/m2e-wtp/web资源”的问题。然后是Maven ->更新项目。

#7


2  

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

我遇到了同样的问题,我可以通过在pom中添加 war 来解决。项目标记中的xml文件。

#8


2  

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

需要更新maven项目>右键点击项目>点击maven >更新项目。

#9


1  

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

goto窗口的菜单>偏好>选择Maven>Java EE集成>uncheck战争项目偏好()

#10


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

嘿,我也面临着一个类似的问题,我只是通过使用这个配置bellow: Configure >>添加项目档案支持在上面描述

#11


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.

我有这个问题,其他的答案对我都不起作用。通过在Package Explorer中右键单击项目并选择Build project,我解决了这个问题。这导致丢失的m2e-wtp文件夹出现。

#12


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.

我正在使用linux mint,我在~中找到了。m2 /库”。锁定“文件1-我删除了它。2-我运行maven clean,它和我一起工作。

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.

注意:这是我对maven的许多问题的解决方案。锁定“防止maven在磁盘上工作。所以我希望它能在其他很多问题上帮助你。

#13


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.

tomcat插件或应用程序没有问题,它只是偶尔需要一次刷新。另外,因为maven正在清理目标。我只需要设置我的maven构建来刷新包含目标文件夹的项目。

Check the option to automatically refresh resources in your maven build

检查选项以自动刷新maven构建中的资源

#14


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.

1)我已经修复了从~中删除锁文件夹。maven /库”。锁”文件夹。2) Open project preferences -> project facet -> Runtimes ->选择您所选择的运行时。3)需要更新maven项目>右键点击项目>点击maven >更新项目。

Thats it, the problem is resolved for me.

就是这样,问题为我解决了。

#15


0  

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

解决方案很简单:首选项—> Maven—> Java EE集成—>支持Java EE配置

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

为什么它一开始就有缺陷,这对我来说一直是个谜……

#16


-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!

这是由于eclipse中m2e-wtp和m2e插件之间的冲突造成的。卸载m2e插件,因为它已经包含在m2e-wtp插件中。重启了,瞧!