【发布时间】:2018-07-08 02:08:44
【问题描述】:
我正在尝试运行 Jenkins 作业,该作业应该分析使用 gitlab 源管理的 maven 构建的 java 项目,使用 maven 的 sonarqube 扫描仪...当我进入该作业的目标时,生成的确切内容使用 SonarQube 服务器创建令牌教程,如下所示:
mvn sonar:sonar \
-Dsonar.host.url=http://***** \
-Dsonar.login=****
它给我抛出了这种错误:
[ERROR] Unknown lifecycle phase "mvn". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/LifecyclePhaseNotFoundException
我不知道在詹金斯工作中我的目标中缺少什么或者我应该添加什么,谢谢。
我的 maven 项目配置的屏幕截图:
【问题讨论】:
-
您是否在 Jenkins 中使用 Maven 构建步骤?如果是这样,它会为您提供初始的
mvn,因此您的实际输出是mvn mvn sonar:sonar... -
通过 Maven 构建步骤,您的意思是如果我使用的是 Maven 项目?我已将构建作业配置屏幕添加到帖子中。
-
所以我大概想通了。