SonarQube TFS Build Error with Community-Edition

tfs
branches

(Sebastian Reger) #1

Hi there,

i have configured a TFS-Build-Defintion for a C#-Project.
The Task “Run Code Analysis” fails, because the property “sonar.branch.name” automatcly is set
Log :

2018-06-21T07:22:31.6601399Z ##[debug]Processed: ##vso[task.logissue type=error;]09:22:31.644 ERROR: Unable to load component class org.sonar.scanner.scan.ProjectLock%0D%0A09:22:31.644 ERROR: Caused by: Unable to load component class org.sonar.scanner.scan.DefaultInputModuleHierarchy%0D%0A09:22:31.644 ERROR: Caused by: Validation of project reactor failed:%0D%0A  o To use the property "sonar.branch.name", the branch plugin is required but not installed. See the documentation of branch support: https://redirect.sonarsource.com/doc/branches.html.%0D%0A09:22:31.644 ERROR:
2018-06-21T07:22:31.6601399Z 09:22:31.644 ERROR: Unable to load component class org.sonar.scanner.scan.ProjectLock
2018-06-21T07:22:31.6601399Z 09:22:31.644 ERROR: Caused by: Unable to load component class org.sonar.scanner.scan.DefaultInputModuleHierarchy
2018-06-21T07:22:31.6601399Z 09:22:31.644 ERROR: Caused by: Validation of project reactor failed:
2018-06-21T07:22:31.6601399Z   o To use the property "sonar.branch.name", the branch plugin is required but not installed. See the documentation of branch support: https://redirect.sonarsource.com/doc/branches.html.
2018-06-21T07:22:31.6601399Z 09:22:31.644 ERROR: 
2018-06-21T07:22:31.6757630Z Process returned exit code 1
2018-06-21T07:22:31.6757630Z ##[error]The SonarQube Scanner did not complete successfully

Can anybody helps?

Many Thanks
Sebastian


Sonarqube Build Failure with Error - Unable to load component class org.sonar.scanner.scan.ProjectLock
(Julien Henry) #4

Hi Sebastian,

Do you confirm the build is triggered on a branch that is not the default branch of your repository? By default the extension will consider that the default branch of your repository (usually named “master” for a Git repo) is the one you want to analyze as the main branch on SonarQube.

But if you try to analyze another branch, then you need the commercial branch plugin.

If you don’t want to use our commercial feature, simply configure 2 build definitions:

  • one with the SonarQube tasks, that will be used for the default branch
  • one without SonarQube tasks, that you can use for other branches and pull requests

Regards,

Julien


(Sebastian Reger) #5

Hi Julien,

thank you for the quick answer.

The Problem is, my project use the TFVC version control. So my default-branch is $/ProjectName/Dev !
Only this branch is used for Analyzing with Sonarqube. Is there a posibility, to unset the “sonar.branch.name”-property?

Kind Regards
Sebastian


(Julien Henry) #7

Hi Sebastian,

Indeed, this is a dead-end situation. There is no way for us to find what is the main branch for TFVC (I think this concept doesn’t even exist, tell me if I’m wrong). So we have no way to decide when to pass sonar.branch.name or not.
After discussion, we think the safest solution is to revert to the previous behavior for TFVC: don’t try to pass sonar.branch.name, never. TFVC users having a SonarQube developer edition will have to manually set the extra property sonar.branch.name=$(Build.SourceBranch)

Does it seem good to you?

FYI https://jira.sonarsource.com/browse/VSTS-161