使用Maven和Eclipse开发web项目时,会出现一个问题,就是发布调试的时候,lib不会自动拷贝到WEB-INF/lib之下,导致classnotfound的错误。
解决方法:
1、“Maven ” –> “Enable dependency Management“
2、Web Deployment Assembly中添加maven dependencies
步骤如下图:
工程 -> 右键 -> preferences
.classpath文件中会有修改
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
变为
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
参考:http://blog.csdn.net/yirentianran/article/details/6429240