Web项目复制到lib下的jar包不自动加载
打开项目的Java source目录,发现没有web app libraries目录
解决:
打开项目源码,打开.classpath文件,内容如下
<classpath>
<classpathentrykind="src" path="src"/>
<classpathentrykind="con"path="melibrary.com.genuitec.eclipse.j2eedt.core.MYECLIPSE_JAVAEE_5_CONTAINER"/>
<classpathentry kind="con"path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attributename="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
<classpathentrykind="output" path="WebRoot/WEB-INF/classes"/>
</classpath>
对比可以自动加载的项目的.classpath文件
<classpath>
<classpathentrykind="src" path="src"/>
<classpathentrykind="con" path="com.genuitec.eclipse.j2eedt.core.J2EE14_CONTAINER"/>
<classpathentrykind="con" path="org.eclipse.jdt.USER_LIBRARY/MyJars"/>
<classpathentrykind="con"path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attributename="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
<classpathentrykind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentrykind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentrykind="output" path="WebRoot/WEB-INF/classes"/>
</classpath>
添加这一句:<classpathentry kind="con"path="org.eclipse.jst.j2ee.internal.web.container"/> 重启eclipse即可