1

我已将 Sonar 配置为在我为 C# 项目构建的 Jenkins 结束时运行。日志显示 Sonar 完成了整个分析,但构建在某种清理步骤上失败了。它还在寻找不存在的 pom.xml。知道为什么 mvn.bat 试图在 Sonar 的独立版本中运行以及如何关闭它/让它成功运行吗?非常感谢。

16:02:28.256 INFO  .b.p.UpdateStatusJob - ANALYSIS SUCCESSFUL, you can browse http://sonarserver:9000
16:02:28.256 INFO  b.p.PostJobsExecutor - Executing post-job class org.sonar.plugins.core.batch.IndexProjectPostJob
16:02:28.288 INFO  b.p.PostJobsExecutor - Executing post-job class org.sonar.plugins.dbcleaner.ProjectPurgePostJob
16:02:28.303 INFO  .p.d.p.KeepOneFilter - -> Keep one snapshot per day between 2012-07-27 and 2012-08-23
16:02:28.303 INFO  .p.d.p.KeepOneFilter - -> Keep one snapshot per week between 2011-08-26 and 2012-07-27
16:02:28.303 INFO  .p.d.p.KeepOneFilter - -> Keep one snapshot per month between 2007-08-31 and 2011-08-26
16:02:28.303 INFO  .d.p.DeleteAllFilter - -> Delete data prior to: 2007-08-31
16:02:28.303 INFO  o.s.c.purge.PurgeDao - -> Clean MyProject:MyProjectDevelopment [id=1]
16:02:28.319 INFO  o.s.c.purge.PurgeDao - <- Clean snapshot 3727
16:02:29.647 INFO  o.s.c.purge.PurgeDao - -> Clean MyProject.Library [id=2]
16:02:29.663 INFO  o.s.c.purge.PurgeDao - -> Clean MyProject.Web [id=3]
16:02:29.663 INFO  o.s.c.purge.PurgeDao - -> Clean MyProjectOmnitureDownloader [id=4]
Total time: 1:04.065s
Final Memory: 4M/26M
[workspace] $ mvn.bat -f "H:\jobs\MyProject\workspace\pom.xml" -e -B sonar:sonar -Dsonar.jdbc.driver=com.mysql.jdbc.Driver "-Dsonar.jdbc.url=jdbc:mysql://sonarserver:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true" ******** ******** -Dsonar.host.url=http://sonarserver:9000 -Dsonar.language=cs
The system cannot find the file specified
FATAL: command execution failed
java.io.IOException: Cannot run program "mvn.bat" (in directory "H:\jobs\MyProject\workspace"): CreateProcess error=2, The system cannot find the file specified
    at java.lang.ProcessBuilder.start(Unknown Source)
    at hudson.Proc$LocalProc.<init>(Proc.java:244)
    at hudson.Proc$LocalProc.<init>(Proc.java:216)
    at hudson.Launcher$LocalLauncher.launch(Launcher.java:709)
    at hudson.Launcher$ProcStarter.start(Launcher.java:338)
    at hudson.Launcher$ProcStarter.join(Launcher.java:345)
    at hudson.tasks.Maven.perform(Maven.java:263)
    at hudson.plugins.sonar.utils.SonarMaven.executeMaven(SonarMaven.java:138)
    at hudson.plugins.sonar.SonarPublisher.executeSonar(SonarPublisher.java:300)
    at hudson.plugins.sonar.SonarPublisher.perform(SonarPublisher.java:261)
    at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)
    at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:710)
    at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:685)
    at hudson.model.Build$RunnerImpl.post2(Build.java:162)
    at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:632)
    at hudson.model.Run.run(Run.java:1463)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:239)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
    at java.lang.ProcessImpl.create(Native Method)
    at java.lang.ProcessImpl.<init>(Unknown Source)
    at java.lang.ProcessImpl.start(Unknown Source)
    ... 19 more
Sonar analysis completed: FAILURE
Build step 'Sonar' changed build result to FAILURE
Build step 'Sonar' marked build as failure
Sending e-mails to: me@myproject.com
Finished: FAILURE
4

1 回答 1

0

您是否安装了 Sonar Jenkins 插件并在您的构建中启用它

Jenkins 插件使用 Maven 启动声纳分析。它在您的工作结束时运行,因此可能看起来像一个清理步骤。

于 2012-08-26T21:21:31.390 回答