我尝试在Hudson中使用Sonar plugin(2.0.1)运行free-style project(3.3.3)后期构建操作,但是我收到错误。
工作日志:
[workspace] $ mvn -f /home/hudson/.hudson333/jobs/Test/workspace/pom.xml -e -B sonar:sonar -Dsonar.jdbc.driver=org.postgresql.Driver -Dsonar.jdbc.url=jdbc:postgresql://sonar/sonar4 ******** ******** -Dsonar.host.url=http://sonar.mycompany.com
FATAL: command execution failed
java.io.IOException: Cannot run program "mvn" (in directory "/home/hudson/.hudson333/jobs/Test/workspace"): error=13, Permission denied
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1041)
at hudson.Proc$LocalProc.<init>(Proc.java:187)
at hudson.Proc$LocalProc.<init>(Proc.java:157)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:649)
at hudson.Launcher$ProcStarter.start(Launcher.java:266)
at hudson.Launcher$ProcStarter.join(Launcher.java:273)
at hudson.tasks.Maven.perform(Maven.java:267)
at hudson.plugins.sonar.utils.SonarMaven.executeMaven(Son arMaven.java:149)
at hudson.plugins.sonar.SonarPublisher.executeSonar(Son arPublisher.java:331)
at hudson.plugins.sonar.SonarPublisher.perform(SonarPublisher.java:292)
at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:51)
at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:736)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:714)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:690)
at hudson.model.Build$RunnerImpl.post2(Build.java:163)
at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:652)
at hudson.model.Run.run(Run.java:1519)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:44)
at hudson.model.ResourceController.execute(ResourceController.java:82)
at hudson.model.Executor.run(Executor.java:137)
Caused by: java.io.IOException: error=13, Permission denied
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:135)
at java.lang.ProcessImpl.start(ProcessImpl.java:130)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1022)
... 19 more
Sonar analysis completed: FAILURE
Finished: FAILURE
Maven配置:
Hudson文件:
.hudson333 [drwxrwxr-x]
maven [drwxrwxr-x]
slavebundle [drwxrwxr-x]
bundled-maven [drwxrwxr-x]
bin [drwxrwxr-x]
mvn [-rwxrwxr-w]
环境:
我找到了以下链接:
但没有合适的答案。
答案 0 :(得分:0)
我发现了三种不同的解决方法:
将mvn
添加到环境PATH
变量。
添加额外的Maven版本
Maven配置(参见Hudson Book):
作业的声纳配置:
将legacy Maven project type与Legacy Maven 2 job type Plugin(3.0.2)
一起使用Maven配置(参见Hudson Book):
注意:Maven的配置是必要的,因为Legacy Maven 2 job type Plugin不知道Hudson的捆绑Maven。
作业的声纳配置: