关注各种黑科技
B站UP主,编程教学,游戏玩家,挂B,金牛座

homebrew 安装tomcat

今天在idea里用java spring,发现起个服务还要单独装tomcat,配置起来确实比python的困难,setting都是xml的,能看到眼花。

tomcat有很多版本 homebrew现在默认9

 brew search tomcat
==> Formulae
tomcat ✔        tomcat-native   tomcat@6        tomcat@7        tomcat@8

brew 应该没办法多版本共存

可以在线查看版本区别 https://formulae.brew.sh/formula/tomcat

brew install tomcat

看Caveats
brew info tomcat
查看服务
brew services list

brew services start tomcat

/usr/local/Cellar/tomcat/9.0.12/bin/catalina run

http://localhost:8080/

后台
http://localhost:8080/manager/html

$ nano /usr/local/Cellar/tomcat/9.0.12/libexec/conf/tomcat-users.xml
添加

<user username="admin" password="password" roles="tomcat,manager-gui" />

brew services restart tomcat

webapp的根目录(CATALINA_HOME)
/usr/local/Cellar/tomcat/9.0.12/libexec/webapps/ROOT/

开发java真是累,比如已经占用8080 端口 再运行catalina run ,报错估计几百行了,真正有用的也就是java.net.BindException: Address already in use (Bind failed)

转载请注明出处
分享到: 更多 (0)

评论 0