我正在尝试在Gitlab CI中添加一个阶段以生成许可证报告。如Gitlab CI指南所述,可以通过在.gitlab-ci.yml文件中包含这样的阶段来轻松完成此工作:
license_management:
stage: analysis
image:
name: "registry.gitlab.com/gitlab-org/security-products/license-management:$CI_SERVER_VERSION_MAJOR-$CI_SERVER_VERSION_MINOR-stable"
entrypoint: [""]
allow_failure: true
variables:
MAVEN_CLI_OPTS: --debug -DskipTests
script:
- /run.sh analyze .
artifacts:
reports:
license_management: gl-license-management-report.json
dependencies: []
except:
variables:
- $LICENSE_MANAGEMENT_DISABLED
期望得到的文件名为:gl-license-management-report.json
但是相反,在生成文件时出现如下异常:
Running license_finder in /builds/root/scs-boilerplate-app/java-spring-boot
LicenseFinder::Maven: is active
/usr/local/rvm/gems/ruby-2.5.1/gems/license_finder-5.6.2/lib/license_finder/package_managers/maven.rb:20:in `current_packages': Command './mvnw org.codehaus.mojo:license-maven-plugin:download-licenses' failed to execute: Exception in thread "main" java.lang.RuntimeException: Could not load wrapper properties from '/builds/root/scs-boilerplate-app/java-spring-boot/.mvn/wrapper/maven-wrapper.properties'. (RuntimeError)
at org.apache.maven.wrapper.WrapperExecutor.<init>(WrapperExecutor.java:72)
at org.apache.maven.wrapper.WrapperExecutor.forWrapperPropertiesFile(WrapperExecutor.java:56)
at org.apache.maven.wrapper.MavenWrapperMain.main(MavenWrapperMain.java:54)
Caused by: java.lang.RuntimeException: No value with key 'distributionUrl' specified in wrapper properties file '/builds/root/scs-boilerplate-app/java-spring-boot/.mvn/wrapper/maven-wrapper.properties'.
at org.apache.maven.wrapper.WrapperExecutor.reportMissingProperty(WrapperExecutor.java:141)
at org.apache.maven.wrapper.WrapperExecutor.readDistroUrl(WrapperExecutor.java:92)
at org.apache.maven.wrapper.WrapperExecutor.prepareDistributionUri(WrapperExecutor.java:78)
at org.apache.maven.wrapper.WrapperExecutor.<init>(WrapperExecutor.java:66)
... 2 more