【发布时间】:2015-07-02 11:03:10
【问题描述】:
我已将性能测试创建为我的主模块的 maven 子模块。所有的测试类都写在 src/main/java 而不是 src/test/java
我能够将项目打包为 jar 并运行它以对我的项目进行性能测试。
我想执行mvn test。要让mvn test 工作,我应该设置<testSourceDirectory> 值。在这种情况下,我在 src/main/java 中有我的代码,我将其设置为:
<testSourceDirectory>src/main/java</testSourceDirectory>
现在mvn test 有效。
但问题是声纳构建失败并出现错误抱怨:can't be indexed twice。很明显,我的 pom testSourceDirectory 和 sourceDirectory 是一样的。
[ERROR] Failed to execute goal
org.codehaus.mojo:sonar-maven-plugin:2.5:sonar (default-cli)
on project Blah: File [relative=XYZ.java, abs=/Path/XYZ.java] can't be indexed twice.
Please check that inclusion/exclusion patterns produce
disjoint sets for main and test files ->
如何解决这个问题?
【问题讨论】:
-
有些日志可能是? “文件已编入索引”是相当稀缺的信息。
-
用确切的错误更新了问题。