Hel*_*ira 5 gradle sonarqube gradle-plugin sonarqube-scan
当将Maven与多模块项目一起使用时,我可以简单地将Sonar插件添加到父POM中:
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.4.0.905</version>
</plugin>
Run Code Online (Sandbox Code Playgroud)
然后在项目根目录中运行它以获取汇总结果:
.../project$ mvn sonar:sonar
Run Code Online (Sandbox Code Playgroud)
或针对特定模块:
.../project$ mvn sonar:sonar -f module/pom.xml
Run Code Online (Sandbox Code Playgroud)
但是,Gradle似乎无法做到这一点。
如果仅apply plugin: 'org.sonarqube'在根项目中应用SonarQube插件(),则在根项目中运行该插件时会得到汇总结果,但是该子项目中没有该插件:
.../project$ ./gradlew :module:sonarqube
FAILURE: Build failed with an exception.
* What went wrong:
Task 'sonarqube' not found in project ':module'.
...
Run Code Online (Sandbox Code Playgroud)
如果仅在子项目中应用SonarQube插件,则在根项目上运行它不会产生汇总结果。
如果我将SonarQube插件应用于所有项目(根项目+子项目),请尝试运行任何Gradle命令输出:
FAILURE: Build failed with an exception.
* Where:
Build file '.../project/build.gradle' line: 38
* What went wrong:
A problem occurred evaluating root project 'project'.
> Failed to apply plugin [id 'org.sonarqube']
> Cannot add extension with name 'sonarqube', as there is an extension already registered with that name.
Run Code Online (Sandbox Code Playgroud)
有没有办法使Gradle的SonarQube插件能够像Maven一样在根项目和子项目中工作?
| 归档时间: |
|
| 查看次数: |
532 次 |
| 最近记录: |