我正在尝试构建和测试一个scala项目。我使用scala-test而不是surefire。我一直收到这个重复的资源错误,但是我不知道哪里或者什么资源被复制了。我使用的命令是"maven test sonar:sonar“。这是输出,
INFO: SonarQube Server 3.7.4
[INFO] [16:36:12.615] Load batch settings
[INFO] [16:36:12.650] User cache: /Users/carolyn_cheng/.sonar/cache
[INFO] [16:36:12.653] Install plugins
[INFO] [16:36:13.069] Install JDBC driver
[INFO] [16:36:13.074] Create JDBC datasource for jdbc:mysql://localhost:3306/sonar
[INFO] [16:36:13.873] Initializing Hibernate
[INFO] [16:36:15.527] Load project settings
[INFO] [16:36:15.547] Apply project exclusions
[INFO] [16:36:15.676]
------------- Scan Orbit
[INFO] [16:36:15.678] Load module settings
[INFO] [16:36:15.790] Quality profile : [name=sonar,language=scala]
[INFO] [16:36:15.801] Excluded tests:
[INFO] [16:36:15.802]
**/package-info.java
[INFO] [16:36:15.829] Configure Maven plugins
[INFO] [16:36:15.854] Compare to previous analysis (2014-03-03)
[INFO] [16:36:15.862] Compare over 30 days (2014-02-05, analysis of 2014-02-26 13:57:06.0) [INFO] [16:36:15.869] Compare to previous version
[INFO] [16:36:15.929] Base dir: /Users/carolyn_cheng/WorkSpace/Orbit
[INFO] [16:36:15.929] Working dir: /Users/carolyn_cheng/WorkSpace/Orbit/target/sonar
[INFO] [16:36:15.929] Source dirs: /Users/carolyn_cheng/WorkSpace/Orbit/src/main/java, /Users/carolyn_cheng/WorkSpace/Orbit/src/main/scala
[INFO] [16:36:15.929] Test dirs: /Users/carolyn_cheng/WorkSpace/Orbit/src/test/java, /Users/carolyn_cheng/WorkSpace/Orbit/src/test/scala, /Users/carolyn_cheng/WorkSpace/Orbit/src/test/java/../scala
[INFO] [16:36:15.929] Binary dirs: /Users/carolyn_cheng/WorkSpace/Orbit/target/classes
[INFO] [16:36:15.929] Source encoding: UTF-8, default locale: en_US
[INFO] [16:36:15.966] Sensor ScalaSourceImporterSensor...
[ERROR] Duplicate source for resource: org.sonar.plugins.scala.language.ScalaFile@36961e51 [INFO]
------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 48.765s
[INFO] Finished at: Fri Mar 07 16:36:18 PST 2014
[INFO] Final Memory: 61M/445M
[INFO]
------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.sonar:sonar-maven-plugin:3.7.4:sonar (default-cli) on project Orbit: Duplicate source for resource: org.sonar.plugins.scala.language.ScalaFile@36961e51 -> [Help 1] [ERROR] 由于某些原因,我总是得到clover-report.xml文件,即使我现在没有使用clover。
请帮帮忙。
发布于 2014-03-13 08:00:20
我也有同样的问题,但我是通过sonar-runner运行的,而不是通过Maven,因为我们使用SBT。我将这些行添加到我的sonar-project.properties文件as described here中
sonar.dynamicAnalysis=reuseReports
sonar.surefire.reportsPath=test-reports
sonar.core.codeCoveragePlugin=cobertura
sonar.java.coveragePlugin=cobertura
sonar.cobertura.reportPath=target/scala-[scala-version]/coverage-report/cobertura.xml注意,你需要把你的scala版本,比如2.10,2.9放在写着scala-version的地方。这让分析开始了,但对我来说,它仍然是坏的,因为我们使用的是String Interpolation。这在Scala 2.10之前是不受支持的,它破坏了Scala分析器。我开始更新包含在Maven POM中的jars,但是将插件迁移到Scala2.10并非易事,因为它使用了was removed after 2.9.3的reflect.generic.ModifierFlags。这些都是可以修复的,但我需要查看Scala源代码!如果您使用的是Scala 2.9,那么它可能会为您工作。
https://stackoverflow.com/questions/22263545
复制相似问题