2013-08-27 58 views
3

升級到聲納3.7,並使用Maven 3推出的分析後:聲納3.7:無法執行王氏行家

mvn sonar:sonar -Dsonar.jdbc.driver=com.mysql.jdbc.Driver -Dsonar.jdbc.url=jdbc:mysql://localhost:3306/sonar -Dsonar.jdbc.username=sonar -Dsonar.jdbc.password=sonar -Dsonar.host.url=http://localhost/sonar 

我得到這個錯誤:

[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.1:sonar (default-cli) on project X: Can not execute SonarQube analysis: Unable to execute Sonar: Task null does not exist -> [Help 1] 
     org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.1:sonar (default-cli) on project X: Can not execute SonarQube analysis 
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217) 
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) 
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) 
      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) 
      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) 
      at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) 
      at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) 
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320) 
      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) 
      at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537) 
      at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196) 
      at org.apache.maven.cli.MavenCli.main(MavenCli.java:141) 
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
      at java.lang.reflect.Method.invoke(Method.java:597) 
      at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290) 
      at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230) 
      at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409) 
      at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352) 
     Caused by: org.apache.maven.plugin.MojoExecutionException: Can not execute SonarQube analysis 
      at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:109) 
      at org.codehaus.mojo.sonar.Bootstraper.start(Bootstraper.java:67) 
      at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:109) 
      at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101) 
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209) 
      ... 19 more 
     Caused by: org.sonar.runner.impl.RunnerException: Unable to execute Sonar 
      at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91) 
      at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75) 
      at java.security.AccessController.doPrivileged(Native Method) 
      at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69) 
      at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50) 
      at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102) 
      at org.sonar.runner.api.Runner.execute(Runner.java:90) 
      at org.sonar.maven.SonarMojo.execute(SonarMojo.java:172) 
      at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:104) 
      ... 23 more 
     Caused by: org.sonar.api.utils.SonarException: Task null does not exist 
      at org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:78) 
      at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:88) 
      at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:73) 
      at org.sonar.batch.bootstrap.BootstrapContainer.executeTask(BootstrapContainer.java:156) 
      at org.sonar.batch.bootstrap.BootstrapContainer.doAfterStart(BootstrapContainer.java:144) 
      at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:88) 
      at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:73) 
      at org.sonar.batch.bootstrapper.Batch.startBatch(Batch.java:92) 
      at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:74) 
      at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:45) 
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
      at java.lang.reflect.Method.invoke(Method.java:597) 
      at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87) 
      ... 31 more 
     [ERROR] 
     [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/MojoExecutionException 

聲納在Tomcat上運行實例。 Maven的版本輸出:

mvn -version 
Apache Maven 3.0.4 (r1232337; 2012-01-17 09:44:56+0100) 
Maven home: /usr/local/Cellar/maven/3.0.4/libexec 
Java version: 1.6.0_51, vendor: Apple Inc. 
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home 
Default locale: fr_FR, platform encoding: MacRoman 
OS name: "mac os x", version: "10.7.5", arch: "x86_64", family: "mac" 
+1

你可以發表你的POM設置的細節? – emeraldjava

+0

我完成我的問題。我通過命令行傳遞屬性。 – gontard

+0

Sonar爲什麼在Tomcat上運行?我相信它有一個內置的應用程序服務器,它運行在9000端口。 –

回答

0

我認爲你錯過了聲納插件定義在你的pom.xml

<plugin> 
    <groupId>org.codehaus.mojo</groupId> 
    <artifactId>sonar-maven-plugin</artifactId> 
    <version>2.0</version> 
</plugin> 
+0

org.codehaus.mojo:sonar-maven-plugin:2.1:聲納被調用。在pom.xml中添加您的conf只會將版本修正爲2.0。 – gontard