1、点击【File】->【Project Structure】菜单(或使用Shift+Ctrl+Alt+S快捷键),打开【Project Structure】窗口。如下图:

【转载】intellij idea如何将web项目打成war包

2、在【ProjectStructure】中选择左侧的【Artifacts】页签。如下图:

【转载】intellij idea如何将web项目打成war包

3、点击中间上面的【转载】intellij idea如何将web项目打成war包,选择【WebApplication:Archive】-> 【Empty】。如下图:

【转载】intellij idea如何将web项目打成war包

【转载】intellij idea如何将web项目打成war包

4、点击上图中的①处,选择【Directory Content】菜单。如下图:

【转载】intellij idea如何将web项目打成war包

【转载】intellij idea如何将web项目打成war包

5、经过上图的选择,已经将除classess目前之外的结构都准备就绪了。如下图:

【转载】intellij idea如何将web项目打成war包

6、选中war包总目录后点击【转载】intellij idea如何将web项目打成war包图标,创建【WEB-INF】和子目录【classes】目录。如下图:

【转载】intellij idea如何将web项目打成war包

7、点击【转载】intellij idea如何将web项目打成war包图标,选择【Module Output】菜单给【classes】目录添加内容。如下图:

【转载】intellij idea如何将web项目打成war包

【转载】intellij idea如何将web项目打成war包

【转载】intellij idea如何将web项目打成war包

8、点击上图中的【OK】按钮,结束war的配置

9、编译及执行打war包,点击【Build】->【BuildArtifacts】->【Build】菜单。如下图:

【转载】intellij idea如何将web项目打成war包

10、找到打包好的war文件,如下图:

【转载】intellij idea如何将web项目打成war包

11、将war包部署到tomcat下的webapps目录下,然后到tomcat下的【bin】目录下启动tomcat,如下图:

【转载】intellij idea如何将web项目打成war包

相关文章:

  • 2021-11-02
  • 2021-11-08
  • 2022-01-15
  • 2021-05-29
  • 2021-09-09
猜你喜欢
  • 2022-02-13
  • 2021-05-27
  • 2021-05-07
  • 2021-11-23
  • 2021-07-27
相关资源
相似解决方案