2013-06-21 63 views
1

我有一個多模塊項目,我試圖用聲吶配置它。但是當我執行時,聲納Findbugs質量配置文件失敗Maven聲吶findbugs失敗,無法編譯源

mvn sonar:sonar 

(在構建項目之後)從根目錄。我有以下異常。

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.0:sonar (default-cli) on project catalog-management-system: Can not execute Sonar 
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:57) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
at java.lang.reflect.Method.invoke(Method.java:601) 
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 Sonar 
at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:118) 
at org.codehaus.mojo.sonar.Bootstraper.start(Bootstraper.java:65) 
at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:90) 
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.api.utils.SonarException: Can not execute Findbugs 
at org.sonar.plugins.findbugs.FindbugsExecutor.execute(FindbugsExecutor.java:149) 
at org.sonar.plugins.findbugs.FindbugsSensor.analyse(FindbugsSensor.java:62) 
at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:70) 
at org.sonar.batch.phases.Phases.execute(Phases.java:101) 
at org.sonar.batch.scan.ScanContainer.doStart(ScanContainer.java:147) 
at org.sonar.batch.bootstrap.Container.start(Container.java:72) 
at org.sonar.batch.scan.ScanTask.scan(ScanTask.java:65) 
at org.sonar.batch.scan.ScanTask.scanRecursively(ScanTask.java:56) 
at org.sonar.batch.scan.ScanTask.scanRecursively(ScanTask.java:54) 
at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:49) 
at org.sonar.batch.bootstrap.TaskContainer.doStart(TaskContainer.java:188) 
at org.sonar.batch.bootstrap.Container.start(Container.java:72) 
at org.sonar.batch.bootstrap.TaskBootstrapContainer.executeTask(TaskBootstrapContainer.java:73) 
at org.sonar.batch.bootstrap.TaskBootstrapContainer.doStart(TaskBootstrapContainer.java:62) 
at org.sonar.batch.bootstrap.Container.start(Container.java:72) 
at org.sonar.batch.bootstrap.BootstrapContainer.doStart(BootstrapContainer.java:104) 
at org.sonar.batch.bootstrap.Container.start(Container.java:72) 
at org.sonar.batch.bootstrapper.Batch.startBatch(Batch.java:88) 
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:72) 
at org.sonar.maven3.SonarMojo.execute(SonarMojo.java:142) 
    at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:113) 
... 23 more 
    Caused by: org.sonar.api.utils.SonarException: Findbugs needs sources to be compiled. Please build project before executing sonar and check the location of compiled classes. 
at org.sonar.plugins.findbugs.FindbugsConfiguration.getFindbugsProject(FindbugsConfiguration.java:84) 
at org.sonar.plugins.findbugs.FindbugsExecutor.execute(FindbugsExecutor.java:107) 
... 43 more 

但是,當我執行聲納:聲納具有包裝類型罐或戰爭的話,成功的某些模塊。我認爲它失敗了,因爲它試圖找到父項目的編譯源。誰能告訴我如何解決這個問題?

回答

4

Findbugs要求您的源代碼已編譯。如果你遵循Sonar documentation,這裏是你應該做的:

mvn clean install -DskipTests=true 
mvn sonar:sonar 

然後,一切都應該工作。

+0

實際上這似乎並不適用於當前版本的Sonar。 –

0
mvn clean install -DskipTests=true 
mvn sonar:sonar 

如果你運行上面,而不是mvn sonar:sonar,Maven的跳過了測試,並沒有任何錯誤生成報告。

+1

這個答案似乎是他去年給出的[Fabrice的回答](http://stackoverflow.com/a/17230908/1005481)的重複。 –