我在自己的电脑上安装了声纳服务器(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 install
和mvn site
正常工作......
答案 0 :(得分:5)
你正面临一个Sonar 3.0的错误(=> http://jira.codehaus.org/browse/SONAR-3442)。我们已经发布了修复此问题的Sonar 3.0.1(请参阅http://www.sonarsource.org/downloads/)。