ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
**1. 安装插件 Pipeline** **2. 新建任务** 新建任务 -> 输入一个任务名称【web-demo-pipeline】 -> 流水线。 **3. 编写脚本** ![](https://img.kancloud.cn/b2/68/b268cf9fb5749589dc753246a95187b9_1196x501.jpg) ```groovy pipeline { agent any stages { stage('拉取代码') { steps { checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'ed522e63-9512-4143-a444-1881af6df298', url: 'git@192.168.1.13:itheima_group/web-demo-pipeline.git']]]) } } stage('编译构建') { steps { sh label: '', script: 'mvn clean package' } } stage('项目部署') { steps { deploy adapters: [tomcat8(credentialsId: '133196f5-f991-4892-98b6-df04e4af21cb', path: '', url: 'http://192.168.1.16:8080/')], contextPath: null, war: 'target/*.war' } } } } ``` **4. 立即构建** ![](https://img.kancloud.cn/3a/3a/3a3a2b2b8b47e3387e7f9b60746b99d0_1120x310.jpg) **5. 访问:http://192.168.1.16:8080/web-demo-pipeline-1.0-SNAPSHOT/** ``` 如果看到此页面,代表项目部署成功啦!--这是master分支 ```