Sonarqube 不识别基本目录
Sonarqube don't recognize base directory
我有下一个问题。我正在 java 中开发一个项目并创建 sonar.properties 文件以使用 SonarQube (v6.7.2)。我的项目有两个模块。项目结构为:
我的项目
|--核心工具
|--src
|--目标
|--pdf-utils
|--src
|--目标
而sonar.properties是:
第一个模块
sonar.moduleKey=com.app.core.pdf:pdf-utils
sonar.projectBaseDir=/var/lib/jenkins/workspace/MyProject/pdf-utils
sonar.projectKey=com.app.core.pdf:pdf-utils
sonar.projectName=pdf-utils
sonar.projectVersion=0.90.0-快照
sonar.sources=/var/lib/jenkins/workspace/MyProject/pdf-utils/src/main/java
sonar.working.directory=/var/lib/jenkins/workspace/MyProject/pdf-utils/目标/声纳
sonar.java.binaries=/var/lib/jenkins/workspace/MyProject/pdf-utils/目标/类
第二个模块
sonar.moduleKey=com.app.core:核心工具
sonar.projectBaseDir=/var/lib/jenkins/workspace/MyProject/core-utils
sonar.projectKey=com.app.core:核心工具
sonar.projectName=核心工具
sonar.projectVersion=0.90.0-快照
sonar.sources=/var/lib/jenkins/workspace/MyProject/core-utils/src/main/java
sonar.working.directory=/var/lib/jenkins/workspace/MyProject/core-utils/目标/声纳
sonar.java.binaries=/var/lib/jenkins/workspace/MyProject/core-utils/目标/类
主模块
sonar.host.url=http://localhost:9000/sonar
sonar.java.source=1.6
sonar.java.target=1.6
sonar.moduleKey=com.app.core:核心全部
sonar.modules=com.app.core:core-utils,com.app.core.pdf:pdf-utils
sonar.projectBaseDir=/var/lib/jenkins/workspace/MyProject
sonar.projectKey=com.app.core:核心全部
sonar.projectName=核心全部
sonar.projectVersion=开发快照
sonar.sourceEncoding=UTF-8
然后运行SonarScanner,结果为:
模块'com.app.core:core-utils'的基目录不存在:/var/lib/jenkins/workspace/MyProject/com.app.core:core-utils
如果我为每个模块放置基本目录,我不知道为什么要这样做。
谢谢!!
sonar.modules
存储子模块的标识符。您必须使用子标识符作为所有子声纳属性的前缀。示例:
# Main module
sonar.host.url=http://localhost:9000/sonar
sonar.java.source=1.6
sonar.java.target=1.6
sonar.modules=coreutils,pdfutils
sonar.projectBaseDir=/var/lib/jenkins/workspace/MyProject
sonar.projectKey=com.app.core:core-all
sonar.projectName=core-all
sonar.projectVersion=DEV-SNAPSHOT
sonar.sourceEncoding=UTF-8
# First module
pdfutils.sonar.projectBaseDir=/var/lib/jenkins/workspace/MyProject/pdf-utils
pdfutils.sonar.projectKey=com.app.core.pdf:pdf-utils
pdfutils.sonar.projectName=pdf-utils
pdfutils.sonar.sources=/var/lib/jenkins/workspace/MyProject/pdf-utils/src/main/java
pdfutils.sonar.working.directory=/var/lib/jenkins/workspace/MyProject/pdf-utils/target/sonar
pdfutils.sonar.java.binaries=/var/lib/jenkins/workspace/MyProject/pdf-utils/target/classes
# Second module
coreutils.sonar.projectBaseDir=/var/lib/jenkins/workspace/MyProject/core-utils
coreutils.sonar.projectKey=com.app.core:core-utils
coreutils.sonar.projectName=core-utils
coreutils.sonar.sources=/var/lib/jenkins/workspace/MyProject/core-utils/src/main/java
coreutils.sonar.working.directory=/var/lib/jenkins/workspace/MyProject/core-utils/target/sonar
coreutils.sonar.java.binaries=/var/lib/jenkins/workspace/MyProject/core-utils/target/classes
我也清理你的属性:
sonar.moduleKey
- 从所有模块中删除
sonar.projectVersion
- 从子模块中删除
我有下一个问题。我正在 java 中开发一个项目并创建 sonar.properties 文件以使用 SonarQube (v6.7.2)。我的项目有两个模块。项目结构为:
我的项目
|--核心工具
|--src
|--目标
|--pdf-utils
|--src
|--目标
而sonar.properties是:
第一个模块
sonar.moduleKey=com.app.core.pdf:pdf-utils
sonar.projectBaseDir=/var/lib/jenkins/workspace/MyProject/pdf-utils
sonar.projectKey=com.app.core.pdf:pdf-utils
sonar.projectName=pdf-utils
sonar.projectVersion=0.90.0-快照
sonar.sources=/var/lib/jenkins/workspace/MyProject/pdf-utils/src/main/java
sonar.working.directory=/var/lib/jenkins/workspace/MyProject/pdf-utils/目标/声纳
sonar.java.binaries=/var/lib/jenkins/workspace/MyProject/pdf-utils/目标/类
第二个模块
sonar.moduleKey=com.app.core:核心工具
sonar.projectBaseDir=/var/lib/jenkins/workspace/MyProject/core-utils
sonar.projectKey=com.app.core:核心工具
sonar.projectName=核心工具
sonar.projectVersion=0.90.0-快照
sonar.sources=/var/lib/jenkins/workspace/MyProject/core-utils/src/main/java
sonar.working.directory=/var/lib/jenkins/workspace/MyProject/core-utils/目标/声纳
sonar.java.binaries=/var/lib/jenkins/workspace/MyProject/core-utils/目标/类
主模块
sonar.host.url=http://localhost:9000/sonar
sonar.java.source=1.6
sonar.java.target=1.6
sonar.moduleKey=com.app.core:核心全部
sonar.modules=com.app.core:core-utils,com.app.core.pdf:pdf-utils
sonar.projectBaseDir=/var/lib/jenkins/workspace/MyProject
sonar.projectKey=com.app.core:核心全部
sonar.projectName=核心全部
sonar.projectVersion=开发快照
sonar.sourceEncoding=UTF-8
然后运行SonarScanner,结果为:
模块'com.app.core:core-utils'的基目录不存在:/var/lib/jenkins/workspace/MyProject/com.app.core:core-utils
如果我为每个模块放置基本目录,我不知道为什么要这样做。
谢谢!!
sonar.modules
存储子模块的标识符。您必须使用子标识符作为所有子声纳属性的前缀。示例:
# Main module
sonar.host.url=http://localhost:9000/sonar
sonar.java.source=1.6
sonar.java.target=1.6
sonar.modules=coreutils,pdfutils
sonar.projectBaseDir=/var/lib/jenkins/workspace/MyProject
sonar.projectKey=com.app.core:core-all
sonar.projectName=core-all
sonar.projectVersion=DEV-SNAPSHOT
sonar.sourceEncoding=UTF-8
# First module
pdfutils.sonar.projectBaseDir=/var/lib/jenkins/workspace/MyProject/pdf-utils
pdfutils.sonar.projectKey=com.app.core.pdf:pdf-utils
pdfutils.sonar.projectName=pdf-utils
pdfutils.sonar.sources=/var/lib/jenkins/workspace/MyProject/pdf-utils/src/main/java
pdfutils.sonar.working.directory=/var/lib/jenkins/workspace/MyProject/pdf-utils/target/sonar
pdfutils.sonar.java.binaries=/var/lib/jenkins/workspace/MyProject/pdf-utils/target/classes
# Second module
coreutils.sonar.projectBaseDir=/var/lib/jenkins/workspace/MyProject/core-utils
coreutils.sonar.projectKey=com.app.core:core-utils
coreutils.sonar.projectName=core-utils
coreutils.sonar.sources=/var/lib/jenkins/workspace/MyProject/core-utils/src/main/java
coreutils.sonar.working.directory=/var/lib/jenkins/workspace/MyProject/core-utils/target/sonar
coreutils.sonar.java.binaries=/var/lib/jenkins/workspace/MyProject/core-utils/target/classes
我也清理你的属性:
sonar.moduleKey
- 从所有模块中删除sonar.projectVersion
- 从子模块中删除