Web App Libraries and Eclipse Build Path

今天在构建web应用的时候遇到一下几个问题:

 

  • WebApp 部署到tomcat正常运行,而在eclipse中运行无法找到jar, Web App Libraries 应包含项目引用的所有jar包,实际为空。

Cause: Eclipse 下的Web project 中所有引用的jar文件要放在WebContent/WEB-INF/lib目录下

  • Eclipse java build path中Web App Libraries无法自动找到WEB-INF的lib目录

Cause: 工程目录的.settings文件夹中org.eclipse.wst.common.component 的配置信息错误

错误配置:

<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId" project-version="1.5.0">
    <wb-module deploy-name="org.springframework.samples.jpetstore">
        <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"/>
        <property name="context-root" value="org.springframework.samples.jpetstore"/>
        <property name="java-output-path"/>
    </wb-module>
</project-modules>

 

正确配置:

<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId" project-version="1.5.0">
    <wb-module deploy-name="org.springframework.samples.jpetstore">
        <wb-resource deploy-path="/" source-path="/WebContent"/>
        <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
        <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
        <property name="context-root" value="org.springframework.samples.jpetstore"/>
        <property name="java-output-path"/>
    </wb-module>
</project-modules>

 

reference:

http://blog.csdn.net/zhengzhb/article/details/6956130

http://www.javahotchocolate.com/tutorials/web-jars.html

 

你可能感兴趣的:(eclipse)