当前位置: 代码迷 >> Web前端 >> eclipse exception:File not found: .\target\m2e-wtp\web-resources\
  详细解决方案

eclipse exception:File not found: .\target\m2e-wtp\web-resources\

热度:800   发布时间:2013-02-06 14:02:21.0
eclipse exception:File not found: ..\target\m2e-wtp\web-resources\
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/org.eclipse.wst.common.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
  相关解决方案