diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 2c8bb17730bbe7a965d5b6eab8f7e52081149516..625385ca30da7d5dd88db4d1607794043cbc94f8 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -41,6 +41,9 @@ build:
     - "./mvnw $MAVEN_POM_WITH_MODELS $MAVEN_CLI_OPTS $MAVEN_OPTS package -DskipTests"
   tags:
     - vips-java
+  artifacts:
+    paths:
+      - target/*.war
 
 test:
   stage: test
@@ -56,7 +59,6 @@ deploy-to-staging:
     - echo "$SSH_PRIVATE_KEY" >> ~/.ssh/id_dsa
     - chmod 600 ~/.ssh/id_dsa
     - echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
-    - "./mvnw $MAVEN_POM_WITH_MODELS $MAVEN_CLI_OPTS $MAVEN_OPTS package -DskipTests"
     - WAR_FILE=$(find target -maxdepth 1 -type f -name "*.war" | sort -n | tail -1 | xargs basename)
     - if [ -z "$WAR_FILE" ]; then echo "No war file found in target directory"; exit 1; fi
     - echo "Create temporary directory on the server"