Hi I tried to use sonar plugin these days and have some questions about this plugin
1. Should we manually execute compile task before sonar task? run "gradle clean sonar" It fails for Findbugs because of no compiled classes. FAILURE: Build aborted because of an internal error. > Building > Building* What went wrong: Build aborted because of an unexpected internal error. Please file an issue at: http://www.gradle.org. > Building * Try: > BuildingRun with > Building--debug > Building option to get additional debug info. > Building * Exception is: > Buildingorg.sonar.api.utils.SonarException: Can not execute Findbugs Caused by: org.sonar.api.utils.SonarException: Findbugs needs sources to be compiled. Please build project or edit pom.xml to set the <outputDirectory> property before executing sonar. > Building at org.sonar.plugins.findbugs.FindbugsConfiguration.getFindbugsProject(FindbugsConfiguration.java:68) > Building at org.sonar.plugins.findbugs.FindbugsExecutor.execute(FindbugsExecutor.java:72) > Building ... 72 more This issue is fixed when execute compileJava task before sonar: "gradle clean compileJava sonar" 2. Should we run test task manually before sonar task to get test information in sonar result ? run "gradle clean compileJava sonar" and go to sonar page, the test result is not generated. Code coverage Test success - 0 tests To generate the test result, run "gradle clean test sonar", test result is shown in the sonar page. Test success 100.0% 0 failures 0 errors 1 tests 0 ms 3. no code coverage information shown in sonar page, how to generate it ? In above sample, the code coverage information is missing in sonar page: Code coverage - And we can found error information in the log of sonar task excution: :testClasses :test :sonar Cobertura report not found at G:\dev\study\java\tools\gradle\practices\sonarPluginTest\.gradle\1.0-milestone-3\sonar-bootstrap\target\site\cobertura\coverage.xml > Building > :sonar So, how to generate the "cobertura\coverage.xml" ? it seems we should run some task for cobertura before we execute sonar task ? In brief, we need to do some preparation before executing sonar plugin. But The userguide and sample for sonar plugin is very simple and no information about this limitation is mentioned. I have to ask help for you guys. And I think the user guide should be improved to add some content for this. Xiaojian
