我们经常会使用sonar做代码质量检查。
可以简单的通过两条命令进行增量检查:
/home/sonar/sonar-runner-dist-2.4/bin/sonar-runner -Dproject.settings=./sonar-project-base.properties -Dsonar.preview.readTimeout=300 -e
/home/sonar/sonar-runner-dist-2.4/bin/sonar-runner -Dproject.settings=./sonar-project-new.properties -Dsonar.preview.readTimeout=300 -e
sonar-project-base.properties内容如下:
sonar.projectKey=code_base
sonar.projectName=code_base
sonar.projectVersion=12.16
sonar.sources=src/java
sonar.tests=src/test
sonar.binaries=build/classes
sonar.projectBaseDir=/home/code
sonar.modules=module1,module2,module3
sonar.sourceEncoding=GBK
sonar.my.property=value
sonar.analysis.mode=incremental
sonar.issuesReport.html.enable=true
sonar.issuesReport.console.enable=true
#sonar.jacoco.reportPath=/home/code_base/build/jacoco/test.exec
sonar.dynamicAnalysis=reuseReports
sonar.java.coveragePlugin=jacoco
sonar-project-new.properties内容如下:
sonar.projectKey=code_new
sonar.projectName=code_new
sonar.projectVersion=12.16
sonar.sources=src/java
sonar.tests=src/test
sonar.binaries=build/classes
sonar.projectBaseDir=/home/code
sonar.modules=module1,module2,module3
sonar.sourceEncoding=GBK
sonar.analysis.mode=preview
sonar.my.property=value
sonar.issuesReport.html.enable=true
sonar.issuesReport.console.enable=true
#sonar.jacoco.reportPath=/home/code_base/build/jacoco/test.exec
sonar.dynamicAnalysis=reuseReports
sonar.java.coveragePlugin=jacoco
可以简单的通过两条命令进行增量检查:
/home/sonar/sonar-runner-dist-2.4/bin/sonar-runner -Dproject.settings=./sonar-project-base.properties -Dsonar.preview.readTimeout=300 -e
/home/sonar/sonar-runner-dist-2.4/bin/sonar-runner -Dproject.settings=./sonar-project-new.properties -Dsonar.preview.readTimeout=300 -e
sonar-project-base.properties内容如下:
sonar.projectKey=code_base
sonar.projectName=code_base
sonar.projectVersion=12.16
sonar.sources=src/java
sonar.tests=src/test
sonar.binaries=build/classes
sonar.projectBaseDir=/home/code
sonar.modules=module1,module2,module3
sonar.sourceEncoding=GBK
sonar.my.property=value
sonar.analysis.mode=incremental
sonar.issuesReport.html.enable=true
sonar.issuesReport.console.enable=true
#sonar.jacoco.reportPath=/home/code_base/build/jacoco/test.exec
sonar.dynamicAnalysis=reuseReports
sonar.java.coveragePlugin=jacoco
sonar-project-new.properties内容如下:
sonar.projectKey=code_new
sonar.projectName=code_new
sonar.projectVersion=12.16
sonar.sources=src/java
sonar.tests=src/test
sonar.binaries=build/classes
sonar.projectBaseDir=/home/code
sonar.modules=module1,module2,module3
sonar.sourceEncoding=GBK
sonar.analysis.mode=preview
sonar.my.property=value
sonar.issuesReport.html.enable=true
sonar.issuesReport.console.enable=true
#sonar.jacoco.reportPath=/home/code_base/build/jacoco/test.exec
sonar.dynamicAnalysis=reuseReports
sonar.java.coveragePlugin=jacoco