0

我正在使用声纳 5.0。在我的项目中,我想使用 cobertura 为我的单元测试生成覆盖率数据,并使用 jacoco 从集成测试中生成数据。可能吗?

当我在我的项目中运行 sonar:sonar 时,出现以下错误:

Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.5:sonar (default-cli) on project sor: Can not add the same measure twice on org.sonar.api.resources.File@220b0a0e[key=src/main/java/business/permission/PermissionManagerBean.java,deprecatedKey=business.permission.PermissionManagerBean,path=src/main/java/business/permission/PermissionManagerBean.java,dir=business/permission,filename=PermissionManagerBean.java,language=Java]: org.sonar.api.measures.Measure@46d9cb65[metricKey=lines_to_cover,metric=Metric[id=38,key=lines_to_cover,description=Lines to cover,type=INT,direction=1,domain=<null>,name=lines_to_cover,qualitative=false,userManaged=false,enabled=true,origin=JAV,worstValue=<null>,bestValue=<null>,optimizedBestValue=false,hidden=false,deleteHistoricalData=false],value=70.0,data=<null>,description=<null>,alertStatus=<null>,alertText=<null>,tendency=<null>,date=<null>,variation1=<null>,variation2=<null>,variation3=<null>,variation4=<null>,variation5=<null>,url=<null>,characteristic=<null>,requirement=<null>,personId=<null>,persistenceMode=FULL,fromCore=false] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.5:sonar (default-cli) on project sor: Can not add the same measure twice on org.sonar.api.resources.File@220b0a0e[key=src/main/java/business/permission/PermissionManagerBean.java,deprecatedKey=.business.permission.PermissionManagerBean,path=src/main/java/business/permission/PermissionManagerBean.java,dir=br/com/sor/business/permission,filename=PermissionManagerBean.java,language=Java]: org.sonar.api.measures.Measure@46d9cb65[metricKey=lines_to_cover,metric=Metric[id=38,key=lines_to_cover,description=Lines to cover,type=INT,direction=1,domain=<null>,name=lines_to_cover,qualitative=false,userManaged=false,enabled=true,origin=JAV,worstValue=<null>,bestValue=<null>,optimizedBestValue=false,hidden=false,deleteHistoricalData=false],value=70.0,data=<null>,description=<null>,alertStatus=<null>,alertText=<null>,tendency=<null>,date=<null>,variation1=<null>,variation2=<null>,variation3=<null>,variation4=<null>,variation5=<null>,url=<null>,characteristic=<null>,requirement=<null>,personId=<null>,persistenceMode=FULL,fromCore=false]
    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:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Can not add the same measure twice on org.sonar.api.resources.File@220b0a0e[key=src/main/java/business/permission/PermissionManagerBean.java,deprecatedKey=.business.permission.PermissionManagerBean,path=src/main/java/business/permission/PermissionManagerBean.java,dir=br/com/sor/business/permission,filename=PermissionManagerBean.java,language=Java]: org.sonar.api.measures.Measure@46d9cb65[metricKey=lines_to_cover,metric=Metric[id=38,key=lines_to_cover,description=Lines to cover,type=INT,direction=1,domain=<null>,name=lines_to_cover,qualitative=false,userManaged=false,enabled=true,origin=JAV,worstValue=<null>,bestValue=<null>,optimizedBestValue=false,hidden=false,deleteHistoricalData=false],value=70.0,data=<null>,description=<null>,alertStatus=<null>,alertText=<null>,tendency=<null>,date=<null>,variation1=<null>,variation2=<null>,variation3=<null>,variation4=<null>,variation5=<null>,url=<null>,characteristic=<null>,requirement=<null>,personId=<null>,persistenceMode=FULL,fromCore=false]
    at org.codehaus.mojo.sonar.bootstrap.ExceptionHandling.handle(ExceptionHandling.java:41)
    at org.codehaus.mojo.sonar.bootstrap.RunnerBootstraper.execute(RunnerBootstraper.java:139)
    at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:138)
    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 add the same measure twice on org.sonar.api.resources.File@220b0a0e[key=src/main/java/business/permission/PermissionManagerBean.java,deprecatedKey=.business.permission.PermissionManagerBean,path=src/main/java/business/permission/PermissionManagerBean.java,dir=br/com/sor/business/permission,filename=PermissionManagerBean.java,language=Java]: org.sonar.api.measures.Measure@46d9cb65[metricKey=lines_to_cover,metric=Metric[id=38,key=lines_to_cover,description=Lines to cover,type=INT,direction=1,domain=<null>,name=lines_to_cover,qualitative=false,userManaged=false,enabled=true,origin=JAV,worstValue=<null>,bestValue=<null>,optimizedBestValue=false,hidden=false,deleteHistoricalData=false],value=70.0,data=<null>,description=<null>,alertStatus=<null>,alertText=<null>,tendency=<null>,date=<null>,variation1=<null>,variation2=<null>,variation3=<null>,variation4=<null>,variation5=<null>,url=<null>,characteristic=<null>,requirement=<null>,personId=<null>,persistenceMode=FULL,fromCore=false]
    at org.sonar.batch.index.DefaultIndex.addMeasure(DefaultIndex.java:226)
    at org.sonar.batch.DefaultSensorContext.saveMeasure(DefaultSensorContext.java:177)
    at org.sonar.plugins.jacoco.JaCoCoSensor$UnitTestsAnalyzer.saveMeasures(JaCoCoSensor.java:93)
    at org.sonar.plugins.jacoco.AbstractAnalyzer.readExecutionData(AbstractAnalyzer.java:172)
    at org.sonar.plugins.jacoco.AbstractAnalyzer.analyse(AbstractAnalyzer.java:120)
    at org.sonar.plugins.jacoco.JaCoCoSensor.analyse(JaCoCoSensor.java:66)
    at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:79)
    at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:70)
    at org.sonar.batch.phases.PhaseExecutor.execute(PhaseExecutor.java:122)
    at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:222)
    at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:93)
    at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:78)
    at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:235)
    at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:230)
    at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:223)
    at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:93)
    at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:78)
    at org.sonar.batch.scan.ScanTask.scan(ScanTask.java:65)
    at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:52)
    at org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:128)
    at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:93)
    at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:78)
    at org.sonar.batch.bootstrap.BootstrapContainer.executeTask(BootstrapContainer.java:171)
    at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:95)
    at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
    at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
    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:100)
    at org.codehaus.mojo.sonar.bootstrap.RunnerBootstraper.execute(RunnerBootstraper.java:135)
    ... 22 more
4

0 回答 0