eclipse下发布Maven Web项目至tomcat后启动报ClassNotFoundEx...

由于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即可,亲测可行,但是在MyEclipse下面不知道行不行没有试过

转载于:https://my.oschina.net/zengjie/blog/88671

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值