diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index d21ac82a9bed165dd737a724268e845527d9c8da..b44b00fd72a4d710af176103a369e42588d28aac 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,21 +1,51 @@
-image: maven:3.8.6-openjdk-11
+image: openjdk:11-jdk
 stages:
   - build
   - test
 
 variables:
-  MAVEN_CLI_OPTS: "-s ci_settings.xml --batch-mode"
+  COMMON_CONFIG_REMOTE: https://root:$CONFIG_ACCESS_TOKEN@$CI_SERVER_HOST/VIPS/vips-common-config.git
+  COMMON_CONFIG_LOCAL: "vips-common-config"
+  SETTINGS_XML: "ci_settings.xml"
+  POM_WITH_MODELS: "pom_with_models.xml"
+  MAVEN_CLI_OPTS: "-s $SETTINGS_XML --batch-mode"
+  MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository -Dmaven.artifact.threads=10"
+  MAIN_BRANCH: "main"
+  RELEASE_BRANCH: "release"
+
+cache:
+  paths:
+    - .m2/repository/
+
+before_script:
+  - git config --global user.name "${GITLAB_USER_NAME}"
+  - git config --global user.email "${GITLAB_USER_EMAIL}"
+  - echo "Get common settings"
+  - git clone $COMMON_CONFIG_REMOTE $COMMON_CONFIG_LOCAL
+  - cd $COMMON_CONFIG_LOCAL
+  - cp $SETTINGS_XML ../$SETTINGS_XML
+  - cd ..
+  - rm -rf $COMMON_CONFIG_LOCAL
+  - apt-get update -y && apt-get install -y python3
+  - 'python build_pom_with_models.py'
 
 build:
   stage: build
   script:
-    - './mvnw $MAVEN_CLI_OPTS compile'
+    - './mvnw -f $POM_WITH_MODELS $MAVEN_CLI_OPTS $MAVEN_OPTS package'
   tags:
     - vips-java
 
 test:
   stage: test
   script:
-    - './mvnw $MAVEN_CLI_OPTS test'
+    - './mvnw -f $POM_WITH_MODELS $MAVEN_CLI_OPTS $MAVEN_OPTS test'
+  tags:
+    - vips-java
+
+deploy-snapshot:
+  stage: deploy
+  script:
+    - './mvnw -f $POM_WITH_MODELS $MAVEN_CLI_OPTS $MAVEN_OPTS deploy'
   tags:
     - vips-java
\ No newline at end of file
diff --git a/build_pom_with_models.py b/build_pom_with_models.py
new file mode 100755
index 0000000000000000000000000000000000000000..ae699271d7e5a3b38bca79d0c1e3cb5933d7013d
--- /dev/null
+++ b/build_pom_with_models.py
@@ -0,0 +1,54 @@
+#!/usr/bin/python3
+
+'''
+Merges pom.xml and models.xml (default) into pom_with_models.xml and
+runs mvn clean install -f pom_with_models.xml
+
+Copyright (C) 2023 NIBIO
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU Affero General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Affero General Public License for more details.
+
+    You should have received a copy of the GNU Affero General Public License
+    along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+@author Tor-Einar Skog <tor-einar.skog@nibio.no>
+'''
+import sys
+import subprocess
+from xml.dom.minidom import parse
+
+# Default
+models_xml_path = "models.xml"
+merged_pom_filename = "pom_with_models.xml"
+
+# Accept alternative models.xml file
+if len(sys.argv) > 1:
+    models_xml_path = sys.argv[1]
+
+# Read contents
+pom_dom = parse("pom.xml")
+try:
+    models_dom = parse(models_xml_path)
+except FileNotFoundError:
+    print("ERROR: File %s not found." % models_xml_path)
+    exit(1)
+
+# Merge the dependency elements from models.xml into pom.xml
+pom_deps_element = pom_dom.getElementsByTagName("dependencies")[0]
+model_dep_elements = models_dom.getElementsByTagName("dependency")
+
+for dep in model_dep_elements:
+    pom_deps_element.appendChild(dep)
+
+# Write the modified pom dom to file
+pom_with_models_file = open(merged_pom_filename,"w")
+pom_dom.writexml(pom_with_models_file)
+pom_with_models_file.close()
diff --git a/ci_settings.xml b/ci_settings.xml
deleted file mode 100644
index da49fc0ffec4b5da556e6482d8f903129998bd81..0000000000000000000000000000000000000000
--- a/ci_settings.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
-    <servers>
-        <server>
-            <id>gitlab-maven</id>
-            <configuration>
-                <httpHeaders>
-                    <property>
-                        <name>Job-Token</name>
-                        <value>${CI_JOB_TOKEN}</value>
-                    </property>
-                </httpHeaders>
-            </configuration>
-        </server>
-    </servers>
-</settings>
\ No newline at end of file