我有一个多模块maven Spring启动项目。在测试管道阶段,我得到以下错误。
The specified user settings file does not exist: /builds/teams/systems/service/app/modals/.m2/ci_settings.xml项目app有两个模块-> service & modals。项目根目录有一个.m2文件夹,其中包含settings.xml文件。
我已经包含了common.gitlab-ci.yml,其中包含了SAST模板。问题是spotbug-sast作业失败,并抱怨service模块没有.m2/setings.xml文件。为了进行测试,我尝试在service模块中的相同路径上创建一个文件,该文件工作正常,但未能构建modals。如果我在modals中创建settings.xml文件,也可以使用modals。
以下是(部分) gitlab-ci yaml:
variables:
MAVEN_CLI_OPTS: -s .m2/ci_settings.xml --batch-mode
MAVEN_OPTS: -Dmaven.repo.local=.m2/repository
stages:
- compile
- test
include:
- project: '/gitlab/'
ref: master
file: '/security/common.gitlab-ci.yml'
compile:
image: maven:3.6.3-jdk-8-slim
stage: compile
script:
- mvn $MAVEN_CLI_OPTS clean compile $MAVEN_OPTS
only:
- merge_requests
- web
test:
image: maven:3.6.3-jdk-8-slim
stage: test
script:
- mvn $MAVEN_CLI_OPTS verify $MAVEN_OPTS
only:
- merge_requests
- web在添加这个SAST模板之前,一切都很完美。我不确定在所有模块中创建settings.xml文件是否正确。
我怎样才能消除这个错误?请帮助理解这是如何工作的。
发布于 2022-04-21 16:08:40
我也遇到了同样的问题,可以通过将Maven设置路径变为绝对路径来解决。在您的示例中,这将是:
variables:
MAVEN_CLI_OPTS: -s $CI_PROJECT_DIR/.m2/ci_settings.xml --batch-modehttps://stackoverflow.com/questions/68167634
复制相似问题