SonarQube扫描程序执行失败:java可以';不能索引两次
我的工作对象是:SonarQube扫描程序执行失败:java可以';不能索引两次,sonarqube,sonarqube-scan,Sonarqube,Sonarqube Scan,我的工作对象是: 声纳qube 7.3 扫描仪3.2.0.1227 我有一个Gradle多模块 sonarqube-03 sonarqube-03-domain sonarqube-03-repository sonarqube-03-repository-impl 我刚刚在根项目sonarqube-03中找到了一个sonar项目.properties文件,内容如下: # must be unique in a given SonarQube instance sonar
- 声纳qube 7.3
- 扫描仪3.2.0.1227
sonarqube-03
sonarqube-03-domain
sonarqube-03-repository
sonarqube-03-repository-impl
我刚刚在根项目sonarqube-03
中找到了一个sonar项目.properties文件,内容如下:
# must be unique in a given SonarQube instance
sonar.projectKey=manolito-labs:sonarqube-03
# this is the name and version displayed in the SonarQube UI. Was mandatory prior to SonarQube 6.1.
sonar.projectName=sonarqube-03
sonar.projectVersion=1.0
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
# This property is optional if sonar.modules is set.
sonar.sources=src
sonar.tests=src
# Encoding of the source code. Default is default system encoding
sonar.sourceEncoding=UTF-8
#Manolito
sonar.exclusions=build/**,\
bin/**,\
gradle/**,\
gradlew,\
gradlew.bat,\
*.gradle
sonar.java.binaries=.
#Multi-Module
sonar.modules=sonarqube-03-domain,\
sonarqube-03-repository,\
sonarqube-03-repository-impl
# Properties can obviously be overriden for
# each module - just prefix them with the module ID
sonarqube-03-domain.sonar.projectName=Module Sonarqube 03 Domain
sonarqube-03-repository.sonar.projectName=Module Sonarqube 03 Repository
sonarqube-03-repository-impl.sonar.projectName=Module Sonarqube 03 Repository Impl
当我在Mac上执行时:$SONARQUBE\u SCANNER/bin/sonar SCANNER
我进入了所有输出的决赛:
...
INFO: Source paths: src
INFO: Test paths: src
INFO: Source encoding: UTF-8, default locale: en_US
INFO: Load server rules
INFO: Load server rules (done) | time=162ms
INFO: Index files
INFO: Excluded sources:
INFO: build/**
INFO: bin/**
INFO: gradle/**
INFO: gradlew
INFO: gradlew.bat
INFO: *.gradle
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 11.684s
INFO: Final Memory: 11M/167M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
ERROR: File sonarqube-03-repository/src/main/java/com/manuel/jordan/repository/PersonRepository.java can't be indexed twice. Please check that inclusion/exclusion patterns produce disjoint sets for main and test files
ERROR:
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.
如果我以调试模式执行($SONARQUBE_SCANNER/bin/sonar SCANNER-X
)
我得到:
...
13:31:07.362 INFO: Source paths: src
13:31:07.363 INFO: Test paths: src
13:31:07.363 INFO: Source encoding: UTF-8, default locale: en_US
13:31:07.370 INFO: Load server rules
13:31:07.480 DEBUG: GET 200 http://localhost:9000/api/rules/list.protobuf | time=109ms
13:31:07.510 INFO: Load server rules (done) | time=140ms
13:31:07.663 DEBUG: Declared extensions of language Python were converted to sonar.lang.patterns.py : **/*.py
13:31:07.663 DEBUG: Declared extensions of language CSS were converted to sonar.lang.patterns.css : **/*.css,**/*.less,**/*.scss
13:31:07.664 DEBUG: Declared extensions of language Go were converted to sonar.lang.patterns.go : **/*.go
13:31:07.664 DEBUG: Declared extensions of language Kotlin were converted to sonar.lang.patterns.kotlin : **/*.kt
13:31:07.664 DEBUG: Declared extensions of language JavaScript were converted to sonar.lang.patterns.js : **/*.js,**/*.jsx,**/*.vue
13:31:07.664 DEBUG: Declared extensions of language C# were converted to sonar.lang.patterns.cs : **/*.cs
13:31:07.664 DEBUG: Declared extensions of language Java were converted to sonar.lang.patterns.java : **/*.java,**/*.jav
13:31:07.665 DEBUG: Declared extensions of language Flex were converted to sonar.lang.patterns.flex : **/*.as
13:31:07.665 DEBUG: Declared extensions of language XML were converted to sonar.lang.patterns.xml : **/*.xml,**/*.xsd,**/*.xsl
13:31:07.665 DEBUG: Declared extensions of language PHP were converted to sonar.lang.patterns.php : **/*.php,**/*.php3,**/*.php4,**/*.php5,**/*.phtml,**/*.inc
13:31:07.666 DEBUG: Declared extensions of language TypeScript were converted to sonar.lang.patterns.ts : **/*.ts,**/*.tsx
13:31:07.680 INFO: Index files
13:31:07.683 INFO: Excluded sources:
13:31:07.684 INFO: build/**
13:31:07.684 INFO: bin/**
13:31:07.684 INFO: gradle/**
13:31:07.684 INFO: gradlew
13:31:07.684 INFO: gradlew.bat
13:31:07.684 INFO: *.gradle
13:31:07.702 DEBUG: 'src/main/java/com/manuel/jordan/repository/PersonRepository.java' indexed with language 'java'
13:31:07.779 INFO: ------------------------------------------------------------------------
13:31:07.779 INFO: EXECUTION FAILURE
13:31:07.779 INFO: ------------------------------------------------------------------------
13:31:07.779 INFO: Total time: 3.231s
13:31:07.846 INFO: Final Memory: 11M/167M
13:31:07.846 INFO: ------------------------------------------------------------------------
13:31:07.846 ERROR: Error during SonarQube Scanner execution
13:31:07.846 ERROR: File sonarqube-03-repository/src/main/java/com/manuel/jordan/repository/PersonRepository.java can't be indexed twice. Please check that inclusion/exclusion patterns produce disjoint sets for main and test files
对于这两种输出,问题是:
ERROR: File
sonarqube-03-repository
/src/main/java
/com/manuel/jordan/repository/PersonRepository.java
can't be indexed twice.
Please check that inclusion/exclusion patterns produce disjoint sets for main and test files
因此,我当前的配置中缺少什么?您错误地配置了
源和测试:
sonar.sources=src
sonar.tests=src
它们指向同一个目录。您甚至可以在日志中阅读:
Please check that inclusion/exclusion patterns produce disjoint sets for main and test files
仅当测试类不在src
目录中时,才应指定sonar.tests
如果仍要扫描测试,则有两个选项:
将测试与来源保持在一起
创建一个新项目,将测试存储在src
目录中。该项目应依赖原始来源
最后,您需要的功能现在不受支持,但是有一个()-请随意观看和投票。您错误地配置了源代码和测试:
sonar.sources=src
sonar.tests=src
它们指向同一个目录。您甚至可以在日志中阅读:
Please check that inclusion/exclusion patterns produce disjoint sets for main and test files
仅当测试类不在src
目录中时,才应指定sonar.tests
如果仍要扫描测试,则有两个选项:
将测试与来源保持在一起
创建一个新项目,将测试存储在src
目录中。该项目应依赖原始来源
最后,您需要的功能现在不受支持,但是有一个()-请随意观看和投票。我明白了。如果两个属性的值相同,则结果相同:a
(点)。即使你是对的。如何和平地为src/main/java
和src/test/java
应用声纳?我想把声纳应用到我的测试和实用测试类中。谢谢,我已经扩展了答案。你能分享一个关于Sonarquebe
在Gradle申请的多模块项目的有效配置吗?其中一些模块与其他模块有依赖关系,并且必须扫描src/main/java
和src/test/java
。我认为您可以只设置sonar.sources=src/main/java,src/test/java
,并将sonar.tests
设为空(sonar.tests=/code>)。您需要的功能现在不受支持,但是有一个()-请随意投票。感谢这两个链接。看来这个软件也需要添加强大的测试支持。我明白了。如果两个属性的值相同,则结果相同:a
(点)。即使你是对的。如何和平地为src/main/java
和src/test/java
应用声纳?我想把声纳应用到我的测试和实用测试类中。谢谢,我已经扩展了答案。你能分享一个关于Sonarquebe
在Gradle申请的多模块项目的有效配置吗?其中一些模块与其他模块有依赖关系,并且必须扫描src/main/java
和src/test/java
。我认为您可以只设置sonar.sources=src/main/java,src/test/java
,并将sonar.tests
设为空(sonar.tests=/code>)。您需要的功能现在不受支持,但是有一个()-请随意投票。感谢这两个链接。似乎这个软件也需要添加强大的测试支持。