idea spring boot项目生成war项目导出,外置tomcat启动war,mac 使用终端启动tomcat 问题解决

1.导出战争包

确认的pom.xml中

 

然后点击package导出副本war

idea spring boot项目生成war项目导出,外置tomcat启动war,mac 使用终端启动tomcat 问题解决_第1张图片

启动完成代码0,项目没问题,

会给出导出路径/Users/emcoo-03/www/simplyeat/emcoo-rest/target/emcoo-rest-0.0.1-SNAPSHOT.war

idea spring boot项目生成war项目导出,外置tomcat启动war,mac 使用终端启动tomcat 问题解决_第2张图片

然后将战争包认近tomact的的webapps目录下,启动tomact后会自动解压war包,我是启动过所以已经解压了

idea spring boot项目生成war项目导出,外置tomcat启动war,mac 使用终端启动tomcat 问题解决_第3张图片

使用命令启动tomact

我直接使用cd命令进入到tomcat的文件的箱子里面

使用ls命令显示当前目录所有文件,

然后启用sudo ./startup.sh 回车完成

关闭tomcat ==> sudo ./shutdown.sh

如果遇到无法找到命令等权限问题,在命令上输入chmod u + x * .sh  就可以了

idea spring boot项目生成war项目导出,外置tomcat启动war,mac 使用终端启动tomcat 问题解决_第4张图片

idea spring boot项目生成war项目导出,外置tomcat启动war,mac 使用终端启动tomcat 问题解决_第5张图片


然后访问localhost:8080/emcoo-rest-0.0.1-SNAPSHOT

然而您需要改成项目为默认启用项目也就是不加项目名

idea spring boot项目生成war项目导出,外置tomcat启动war,mac 使用终端启动tomcat 问题解决_第6张图片

打开server.xml中拉倒最下面找到host节点加入

的docBase为绝对路径


保存好了,重新启动


下面是去看的tomcat都启动了些什么项目

idea spring boot项目生成war项目导出,外置tomcat启动war,mac 使用终端启动tomcat 问题解决_第7张图片

点击后需要登录点取消会出现401,然后我只要就可以了,这个就是登录账号与密码


idea spring boot项目生成war项目导出,外置tomcat启动war,mac 使用终端启动tomcat 问题解决_第8张图片

他就是叫你这个意思,你懂得

然后去tomact文件conf下面找tomcat-users.xml进去配置,把他给你的复制放前进去,密码自定义,保存ok,重启tomcat

idea spring boot项目生成war项目导出,外置tomcat启动war,mac 使用终端启动tomcat 问题解决_第9张图片

idea spring boot项目生成war项目导出,外置tomcat启动war,mac 使用终端启动tomcat 问题解决_第10张图片

idea spring boot项目生成war项目导出,外置tomcat启动war,mac 使用终端启动tomcat 问题解决_第11张图片

这里你可以直接部署war项目到tomcat项目中,不用手动放入到webapps中


你可能感兴趣的:(idea spring boot项目生成war项目导出,外置tomcat启动war,mac 使用终端启动tomcat 问题解决)