How can I set the path of the settings.xml from environment variable in a mvn build?
I have tried:
export MAVEN_OPTS="-s /tmp/settings.xml"
or
export MAVEN_OPTS="--settings /tmp/settings.xml"
but it not works.
I need it, because I cannot modify the build command.
You could try something like this in your gitlab-ci build script, just before calling mvn
:
(see https://maven.apache.org/configure.html#mvn-maven-config-file )
mkdir -p .mvn && echo "-s /tmp/settings.xml" >> .mvn/maven.config
This does not modify the repo, only adds a file to the local checkout within the running build job.
Starting with Maven 4 this should also work:
export MAVEN_ARGS="-s /tmp/settings.xml"
see https://maven.apache.org/configure.html#maven_args-environment-variable
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.