GitLab CI 集成
GitLab CI 自动化 Maven 构建。
.gitlab-ci.yml
YAML
stages:
- build
- test
- deploy
build:
stage: build
image: maven:3.9
script:
- mvn clean compile
test:
stage: test
image: maven:3.9
script:
- mvn test
deploy:
stage: deploy
image: maven:3.9
script:
- mvn deploy
only:
- main
要点总结
- stages 定义构建阶段
- image 使用 Maven Docker 镜像
- script 执行 mvn 命令
- only 控制触发分支
📝 发现内容有误?点击此处直接编辑