如何更改默认的 Eclipse WTP“Web 资源”动态文件夹

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3422746/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 14:58:13  来源:igfitidea点击:

How to change default Eclipse WTP "Web Resources" dynamic folder

javaeclipseeclipse-wtp

提问by CHiRo79

I need to change the default Eclipse WTP "Web Resources" dynamic folder. Currently it points to WebContent, and I need to point to src\main\webapp.

我需要更改默认的 Eclipse WTP“Web 资源”动态文件夹。目前它指向 WebContent,我需要指向 src\main\webapp。

回答by CHiRo79

I found the solution: Under .settings folder in your project's folder, there is a file named "org.eclipse.wst.common.component", inside it change the line <wb-resource deploy-path="/" source-path="/WebContent"/>with <wb-resource deploy-path="/" source-path="/src/main/webapp"/>.

我找到了解决办法:在.settings在项目的文件夹,文件夹,有一个名为“org.eclipse.wst.common.component”,里面更改行的文件<wb-resource deploy-path="/" source-path="/WebContent"/><wb-resource deploy-path="/" source-path="/src/main/webapp"/>

That's all!

就这样!

回答by ericbn

I prefer the following solution, as the configuration is then saved in the .projectfile and also all files are kept visible in the Eclipse Project Explorer.

我更喜欢以下解决方案,因为配置随后保存在.project文件中,并且所有文件都在 Eclipse 项目资源管理器中保持可见。

Create a Linked Folder called WebContentpointing to /src/main/webapp:

创建一个名为WebContent指向的链接文件夹/src/main/webapp

Right click project > New > Folder. Folder name: WebContent. Advanced > Link to alternate location (Linked Folder): PROJECT_LOC/src/main/webapp.

右键单击项目 > 新建 > 文件夹。文件夹名称:WebContent。先进>链接到备用位置(链接的文件夹): PROJECT_LOC/src/main/webapp

回答by elciospy

Give Preference to eclipse GUI!

优先使用eclipse GUI!

if don't appear to you see this

如果你没有看到这个

Unable to find Deployment assembly Eclipse Juno

无法找到部署程序集 Eclipse Juno

enter image description here

在此处输入图片说明

回答by Mykhaylo Adamovych

  1. Disable "Dynamic Web Module" project nature, click "Apply" button
  2. Enable previous option checkbox, notice "Feather configuration available..." at the bottom.
  3. Click "Feather configuration available..." link and change directory
  4. Click "Apply" button
  1. 禁用“Dynamic Web Module”项目性质,点击“Apply”按钮
  2. 启用上一个选项复选框,注意底部的“羽化配置可用...”。
  3. 单击“羽毛配置可用...”链接并更改目录
  4. 点击“应用”按钮

回答by Josefersd

In my case the problem was that the jsp located in resources/templates were not found

就我而言,问题是找不到位于资源/模板中的 jsp

The solution has been to change

解决方法是改变

<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>

by the following

通过以下

<wb-resource deploy-path="/" source-path="/src/main/resources"/>

That is, modifying the file

也就是修改文件

.settings\org.eclipse.wst.common.component

回答by sangeeth

Or you may even do a simple rename of WebContent directory. Eclipse will update the above mention settings files

或者您甚至可以对 WebContent 目录进行简单的重命名。Eclipse 会更新上面提到的设置文件