maven项目中关于<packaging>war</packaging>报错解决办法

今天写了一个maven项目,到最后<packaging>war</packaging>报错了,尝试很多办法都解决不了,最后得以在一个博主帖子里的方法完美解决。下面我将该方法分享给大家!

首先看自己的项目中有没有web.xml这个文件,src→main→webapp→WEB-INF

如果没有自己利用工具生成一个或者是去网上找一个,都可以

接下来打开web.xml,添加如下配置文件,复制即可

<welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.htm</welcome-file>
        <welcome-file>index.jsp</welcome-file>
        <welcome-file>default.html</welcome-file>
        <welcome-file>default.htm</welcome-file>
        <welcome-file>default.jsp</welcome-file>
    </welcome-file-list>

最后右键项目maven→Update Project  选中 Force Update of Snapshots/Releases

最后点击“OK”,等右下角更新完,问题就解决了!

如果这篇文章能帮你解决问题,请评论一下,谢谢

猜你喜欢

转载自blog.csdn.net/Websphere_zxf/article/details/81533472
今日推荐