Register a Docker runner and use one of the official Maven Docker images, e.g., maven:3-jdk-11
in your .gitlab-ci.yml
file:
image: maven:3-jdk-11
build:
script: "mvn install -B"
Note the -B
flag, which is recommended for non-interactive use.
As far as I understand, it does not matter whether the runner is shared or specific.