IntelliJ IDEA 2019.3.1使用gradle构建, 在 tomcat运行web 项目时,出现 xxx.war not found for the web module.

问题描述:

IDE 是 IntelliJ IDEA 2019.3.1 ,使用gradle构建的java项目,在 tomcat运行时,Springmvc的相关配置 和lib 没有被加载,后台出现 xxx.war not found for the web module。

原因:

idea 设置有问题,把项目的构建全部交给 gradle。

解决方法:

将项目的构建、运行、测试 交给 IntelliJ IDEA 即可解决问题(如下图所示)。

IntelliJ IDEA 2019.3.1使用gradle构建, 在 tomcat运行web 项目时,出现 xxx.war not found for the web module.

其他说明:

如果是web项目,要加上 apply plugin:'war' ,在webapp的左边图标上面出现一个蓝色的小圆圈,表示配置 成功。

IntelliJ IDEA 2019.3.1使用gradle构建, 在 tomcat运行web 项目时,出现 xxx.war not found for the web module.