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即可