[英]SonarQube for multi module project for Android
I have been through many articles and posts and sadly not a single one seems clear to me.我浏览过很多文章和帖子,遗憾的是,我似乎没有一篇清楚。 I want to integrate sonarqube for my android project.
我想为我的 android 项目集成 sonarqube。 The structure of my project is as below:
我的项目结构如下:
Initially, I had setup a single sonarqube.gradle the way it is mentioned here: What is the correct way to configure an Android project with submodules for use with the sonarqube gradle plugin? Initially, I had setup a single sonarqube.gradle the way it is mentioned here: What is the correct way to configure an Android project with submodules for use with the sonarqube gradle plugin?
But what it is doing for me is overwriting the data with the last module it processed.但它为我做的是用它处理的最后一个模块覆盖数据。 Which means I see code line in sonarqube login for only domain.
这意味着我在 sonarqube 中看到代码行仅用于域登录。 If I do not add apply from: '../sonarqube.gradle' in domain then I can see code for database.
如果我没有在域中添加apply from: '../sonarqube.gradle'那么我可以看到数据库的代码。 If I do not add apply from: '../sonarqube.gradle' in database and domain then I see it for data.
如果我没有在数据库和域中添加apply from: '../sonarqube.gradle'那么我会看到它的数据。 So I am thinking its overwriting the logs.
所以我认为它会覆盖日志。
Can someone help me to understand what is the right way to setup sonarqube for multimodule project in Android?有人可以帮助我了解在 Android 中为多模块项目设置 sonarqube 的正确方法是什么?
apply plugin: "org.sonarqube"
sonarqube {
properties {
property "sonar.projectName", "my-app"
property "sonar.projectKey", "my-app"
property "sonar.host.url", "URL"
property "sonar.sources", "./src/main/"
property "sonar.sourceEncoding", "UTF-8"
property "sonar.language", "kotlin"
property "sonar.login", "token"
property "sonar.projectVersion", "1.0"
property "sonar.analysis.mode", "publish"
property "sonar.android.lint.report", "./build/outputs/lint-results-debug.xml"
property "sonar.exclusions", "**/BuildConfig.class,**/R.java,**/R\$*.java,src/main/gen/**/*,src/main/assets/**/*"
}
}
Remove the projectKey property and declare it only inside the root build.gradle:删除 projectKey 属性并仅在根 build.gradle 内声明它:
apply plugin: "org.sonarqube"
sonarqube {
properties {
property "sonar.projectName", "my-app"
property "sonar.host.url", "URL"
property "sonar.sources", "./src/main/"
property "sonar.sourceEncoding", "UTF-8"
property "sonar.language", "kotlin"
property "sonar.login", "token"
property "sonar.projectVersion", "1.0"
property "sonar.analysis.mode", "publish"
property "sonar.android.lint.report", "./build/outputs/lint-results-debug.xml"
property "sonar.exclusions", "**/BuildConfig.class,**/R.java,**/R\$*.java,src/main/gen/**/*,src/main/assets/**/*"
}
}
Analyzing Multi-Project Builds分析多项目构建
Off doc link https://docs.sonarqube.org/latest/analysis/scan/sonarscanner-for-gradle/关闭文档链接https://docs.sonarqube.org/latest/analysis/scan/sonarscanner-for-gradle/
// build.gradle in:app
sonarqube {
properties {
property "sonar.*", "{value}"
}
}
// build.gradle in :feature-module
subprojects {
sonarqube {
properties {
property "sonar.*", "{value}"
}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.