創建maven web項目
- 新建項目,選擇Maven:選擇webapp(注意:其中有兩個webapp,我們選擇maven-archetype-webapp)
- 填好相應的id
- 確定使用maven的來源:
- 然後就next-finish就行啦
配置tomcat
- configurations
- 加號-tomcat-local
- 這時候會發現沒有artifacts可以選擇
- 返回,使用maven進行打包
- 打包完,打開target目錄,可以看見生成的war包
- 打開project-structure,選擇artifacts-> + -> web application archive
- 輸入與war包包名一樣的output name ,output directory也指向target目錄
- 此時就有了artifacts選擇了
- 運行,完成!