首先需要先建好 web 相关目录以及 WEB-INF 文件夹和 web.xml,为后续 IDEA 自动识别做准备。 按下图设置 web 目录让 IDEA 可以识别: 接下来添加 Artifacts: 最后设置 tomcat 服务器: