IDEA部署springboot项目至本地tomcat时出现not found for the web module问题解决

当我们想把可以直接运行的springboot放入本地tomcat容器中时,要做一些简单的配置

配置如下:

1.在springboot的web模块中移除对tomcat的依赖


    org.springframework.boot
    spring-boot-starter-web
    
        
        
            org.springframework.boot
            spring-boot-starter-tomcat
        
    

2.添加servlet-api依赖


    javax.servlet
    javax.servlet-api
    3.1.0
    compile

3.修改启动类,添加继承SpringBootServletInitializer

 

但是在配置好IDEA中tomcat配置时,发现not found for the web module,程序无法启动,在tomcat的work文件夹中没有文件。

解决方案:

勾选 project Structure中的 Include in project build

IDEA部署springboot项目至本地tomcat时出现not found for the web module问题解决_第1张图片

再build中选择build Artifacts,重启服务:

tomcat启动正常,项目正常访问

你可能感兴趣的:(IDEA部署springboot项目至本地tomcat时出现not found for the web module问题解决)