eclipse exception:File not found: ..\target\m2e-wtp\web-resources\
What is this web resources folder
target/m2e-wtp/web-resources/ is a folder containing automatically generated resources, that need to be deployed on the application server. These generated resources are :
pom.properties and MANIFEST.MF generated by the mavenarchiver plugin
resources defined in the <webResources> section of the maven-war-plugin's configuration, or filtered web.xml
The target/m2e-wtp/web-resources/ is derived. In Eclipse lingo, it means it'll display a warning if you try to manually edit the files it contains, as they'll most likely be overridden automatically in the next (incremental or not) project build.
If you look in your <project>/.settings/ormon.component file, you will see /target/m2e-wtp/web-resources is defined BEFORE the regular war source directory :
<project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="webapp">
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp"/>
<property name="context-root" value="webapp"/>
<property name="java-output-path" value="/webapp/target/classes"/>
</wb-module>
</project-modules>
The rationale behind this order is, if two files from two different source folders collide, WTP will deploy the first one it finds. So if you filter your web.xml sitting under src/main/webapp/WEB-INF, you will want the filtered version to be deployed on the server, that is target/m2e-wtp/web-resources/WEB-INF/web.xml. If, for some reason, you would like to disable the use of target/m2e-wtp/web-resources/, well, know that you can. i
修改myeclipse工程目录下.settings中:
org.eclipse.wst.common.component文件;
修改wb-resource顺序为:所要的排最上面
<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="winshare-center">
<wb-resource deploy-path="/" source-path="/src/main/webapp"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<property name="java-output-path" value="/winshare-center/target/classes"/>
<property name="component.exclusion.patterns" value="build/**"/>
<property name="context-root" value="winshare-center"/>
</wb-module>
</project-modules>
本文详细解释了Eclipse中web-resources文件夹的用途,它包含自动生成的资源,需要部署到应用服务器。通过设置org.eclipse.wst.common.component文件中的wb-resource顺序,可以控制资源部署的优先级。
8078

被折叠的 条评论
为什么被折叠?



