紧接上文
4、新建Maven项目
clean package -Dmaven.test.skip=true 用于构建项目并跳过执行测试
拉到最后选择构建后操作
SSH server
web
Exec command
scp 192.168.77.18:/root/.jenkins/workspace/probe/psi-probe-web/target/probe.war /usr/local/tomcat/webapps/
/usr/local/tomcat/bin/startup.sh
拉到最后点击保存
5、验证 Jenkins 自动打包部署结果
在web主机上查看 probe 目录是否被拷贝到/usr/local/tomcat/webapps 目录下
ls /usr/local/tomcat/webapps/probe -l
vim /usr/local/tomcat/conf/tomcat-users.xml
<role rolename="manager-gui"/>
<role rolename="admin-gui"/>
<user username="tomcat" password="tomcat" roles="manager-gui,admin-gui"/>
</tomcat-users> # 在此行前加入上面三行
vim /usr/local/tomcat/webapps/manager/META-INF/context.xml
<!-- <Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" /> -->
/usr/local/tomcat/bin/shutdown.sh
/usr/local/tomcat/bin/startup.sh
访问192.168.77.19:8080/probe
账户密码都是tomcat