全部学科
Python全栈
python
NodeJS全栈
nodejs
小程序首页
📅 2026-05-23 8 分钟 ✍️ juanwangdev

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 控制触发分支

📝 发现内容有误?点击此处直接编辑

← 上一篇 GitHub Actions 配置
下一篇 → Jenkins 流水线集成
想查看更多题目和详细解析?
小程序提供完整的题库、模拟考试和详细解析
马上就来

长按或扫描二维码,立即体验

扫码体验小程序
马上就来
使用微信扫描二维码
立即体验完整题库