From 21c99b413b447fb9cb04a7f66a75f31d4604a5f0 Mon Sep 17 00:00:00 2001
From: Alexander Diewald <diewald@fortiss.org>
Date: Mon, 14 Sep 2020 10:51:00 +0200
Subject: [PATCH] Add a stage to clean compiled classes.

---
 .gitlab-ci.yml | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index a4904d8..1459340 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,6 +1,7 @@
 image: git.fortiss.org:5001/af3/maven-releng:latest
 
 stages:
+  - clean
   - build
   - test
   - deploy
@@ -16,6 +17,17 @@ variables:
   MAVEN_TEST_OPTS: "-Dbuild.tests=true"
   MAVEN_BUILD_DIR: "-Duser.dir=/builds/$CI_PROJECT_PATH"
 
+clean:
+  stage: clean
+  cache:
+    key: Default
+  rules:
+    - if: '$BUILD_TYPE == "clean"' # This rule will be evaluated
+      when: on_success
+  before_script:
+    - git submodule update $GIT_SUBMODULE_OPTS
+  script:
+    - mvn $MAVEN_CLI_OPTS $MAVEN_BUILD_OPTS clean
 
 build:
   stage: build
-- 
GitLab