由于Maven项目通过pom文件自动管理依赖,所以在WEB-INF/lib下不会有任何的jar包文件,需要修改项目配置文件.project和classpath配置文件.clsspath文件。
打开.project文件先在buildSpecs下面加入两个节点。
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.maven.ide.eclipse.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
在natures节点下面加入
<nature>org.maven.ide.eclipse.maven2Nature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
最后修改.classpath文件(这个文件在工程的根目录下面),加入:
<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>
重新发布到tomcat即可。