3

我在自己的电脑(Windows XP)上安装了声纳服务器,并在 Tomcat 上部署了带有 MySQL 数据库的声纳。我成功地分析了一个旧项目。但是对于我当前的项目,我在尝试执行时遇到了这个异常mvn sonar:sonar

编辑:

[INFO] [14:39:37.254] Sensor CoberturaSensor done: 218 ms
[INFO] [14:39:37.254] Sensor Maven dependencies...
[INFO] [14:39:41.426] Sensor Maven dependencies done: 4172 ms
[INFO] [14:39:41.848] Execute decorators...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:53.354s
[INFO] Finished at: Tue May 15 14:39:43 CEST 2012
[INFO] Final Memory: 21M/138M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.0:sonar (d
efault-cli) on project XXX: Can not execute Sonar: Fail to decorate 'com.myPackage
.myClass': 793 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal o
rg.codehaus.mojo:sonar-maven-plugin:2.0:sonar (default-cli) on project XXX: 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.buildProje
ct(LifecycleModuleBuilder.java:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
ct(LifecycleModuleBuilder.java:59)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBu
ild(LifecycleStarter.java:183)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Lifecycl
eStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
        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(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun
cher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
a:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
uncher.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(Default
BuildPluginManager.java:101)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:209)
        ... 19 more
Caused by: org.sonar.api.utils.SonarException: Fail to decorate 'com.myPackage.myClass
'
        at org.sonar.batch.phases.DecoratorsExecutor.executeDecorator(Decorators
Executor.java:84)
        at org.sonar.batch.phases.DecoratorsExecutor.decorateResource(Decorators
Executor.java:70)
        at org.sonar.batch.phases.DecoratorsExecutor.decorateResource(Decorators
Executor.java:63)
        at org.sonar.batch.phases.DecoratorsExecutor.decorateResource(Decorators
Executor.java:63)
        at org.sonar.batch.phases.DecoratorsExecutor.execute(DecoratorsExecutor.
java:55)
        at org.sonar.batch.phases.Phases.execute(Phases.java:94)
        at org.sonar.batch.bootstrap.ProjectModule.doStart(ProjectModule.java:14
3)
        at org.sonar.batch.bootstrap.Module.start(Module.java:83)
        at org.sonar.batch.bootstrap.BatchModule.analyze(BatchModule.java:115)
        at org.sonar.batch.bootstrap.BatchModule.doStart(BatchModule.java:105)
        at org.sonar.batch.bootstrap.Module.start(Module.java:83)
        at org.sonar.batch.bootstrap.BootstrapModule.doStart(BootstrapModule.jav
a:109)
        at org.sonar.batch.bootstrap.Module.start(Module.java:83)
        at org.sonar.batch.bootstrapper.Batch.startBatch(Batch.java:72)
        at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:59)
        at org.sonar.maven3.SonarMojo.execute(SonarMojo.java:143)
        at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:113)

        ... 23 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 793
        at org.sonar.plugins.core.timemachine.tracking.HashedSequenceComparator.
equals(HashedSequenceComparator.java:34)
        at org.sonar.plugins.core.timemachine.ViolationTrackingBlocksRecognizer.
computeLengthOfMaximalBlock(ViolationTrackingBlocksRecognizer.java:48)
        at org.sonar.plugins.core.timemachine.ViolationTrackingDecorator.mapViol
ations(ViolationTrackingDecorator.java:130)
        at org.sonar.plugins.core.timemachine.ViolationTrackingDecorator.decorat
e(ViolationTrackingDecorator.java:70)
        at org.sonar.batch.phases.DecoratorsExecutor.executeDecorator(Decorators
Executor.java:79)
        ... 39 more

我不明白问题出在哪里。请问有人有答案吗?它可以来自我的 POM 配置吗?

PS:命令行mvn clean installmvn site工作正常...

4

1 回答 1

5

您正面临 Sonar 3.0 的错误 (=> http://jira.codehaus.org/browse/SONAR-3442 )。我们发布了修复此问题的Sonar 3.0.1(请参阅http://www.sonarsource.org/downloads/ )。

于 2012-05-15T12:50:44.650 回答