maven编译 如何自定义settings.xml

gitlab-ci 流水线配置如下:

maven-build:
  image: maven:3-jdk-8-alpine
  stage: package
  variables:
    MAVEN_CLI_OPTS: "-s /root/.m2/settings.xml --batch-mode"
  script:
    - ls -l /root/.m2
    - mvn clean package -Dmaven.test.skip=true $MAVEN_CLI_OPTS
  cache:
    <<: *global_cache
    policy: push
  only:
    - develop@xxxxx/xxxx
  tags:
    - runner

错误信息如下:

Running with gitlab-runner 14.6.0 (5316d4ac)
  on runner-dev-1 vvRY2g2c
Preparing the "docker" executor
Using Docker executor with image maven:3-jdk-8-alpine ...
Pulling docker image maven:3-jdk-8-alpine ...
Using docker image sha256:7445f83cd169b9f0b185e443e755ece1e37d3cf1e2e90f9180afad2fdb9d2bc4 for maven:3-jdk-8-alpine with digest maven@sha256:16691dc7e18e5311ee7ae38b40dcf98ee1cfe4a487fdd0e57bfef76a0415034a ...
Preparing environment
00:01
Running on runner-vvry2g2c-project-2-concurrent-0 via 291197447c8e...
Getting source from Git repository
00:01
Fetching changes with git depth set to 50...
Reinitialized existing Git repository in /builds/xxxx/xxxxxx/.git/
Checking out b45011d9 as develop...
Skipping Git submodules setup
Restoring cache
00:01
Not downloading cache develop-1 due to policy
Executing "step_script" stage of the job script
00:02
Using docker image sha256:7445f83cd169b9f0b185e443e755ece1e37d3cf1e2e90f9180afad2fdb9d2bc4 for maven:3-jdk-8-alpine with digest maven@sha256:16691dc7e18e5311ee7ae38b40dcf98ee1cfe4a487fdd0e57bfef76a0415034a ...
$ ls -l /root/.m2
total 12
-rw-r--r--    1 root     root          2236 Jan 15 07:03 copy_reference_file.log
drwxr-xr-x    3 root     root          4096 Jan 15 06:24 repository
-rw-r--r--    1 root     root           327 Jan 14 09:59 settings-docker.xml
$ mvn clean package -Dmaven.test.skip=true $MAVEN_CLI_OPTS
[ERROR] Error executing Maven.
[ERROR] The specified user settings file does not exist: /root/.m2/settings.xml
Cleaning up project directory and file based variables
00:01
ERROR: Job failed: exit code 1