VSTS + SonarCloud (paid version) Unable to load component / Project was never analyzed / Failed to load profiles

sonarcloud
sonarqube
vsts

(Aaron) #1

I get this error nunning the Scan step:

“Unable to load component class org.sonar.plugins.github.GitHubPluginConfiguration”

A search in DuckDuckGo only showed a Google forum post where a tech said “Since this is a private repo, let’s chat privately.” which didn’t solve the question.


(Nicolas Bontoux) #2

Hi Aaron,

Could you share the full stack trace ? That might give a better chance at understanding the root error. Especially as this error you mention:

Unable to load component class org.sonar.plugins.github.GitHubPluginConfiguration

Has been seen in various threads already: here and here (I recommend you check those and see if it helps), so only the complete error/stack will help further diagnose.


(Aaron) #3

@NicoB thank you for the reply! Those other questions were dealing with Maven and Travis. I’m using VSTS (*.visualstudio.com) with the SonarQube extension.

Here is the stack trace:

16:50:31.299 ERROR: Error during SonarQube Scanner execution
16:50:31.299 ERROR: Unable to load component class org.sonar.scanner.scan.ProjectLock
16:50:31.299 ERROR: Caused by: Unable to load component class org.sonar.scanner.scan.DefaultInputModuleHierarchy
16:50:31.300 ERROR: Caused by: Unable to load component class org.sonar.scanner.scan.ProjectBuildersExecutor
16:50:31.300 ERROR: Caused by: Unable to load component class org.sonar.plugins.github.PullRequestProjectBuilder
16:50:31.300 ERROR: Caused by: Unable to load component class org.sonar.plugins.github.GitHubPluginConfiguration

16:50:31.300 ERROR: Caused by: Unable to load component class org.sonar.scanner.scan.MutableProjectSettings
16:50:31.301 ERROR: Caused by: Unable to load component class org.sonar.scanner.repository.ProjectRepositories
16:50:31.301 ERROR: Caused by: Unable to load component interface org.sonar.scanner.scan.branch.BranchConfiguration
16:50:31.301 ERROR: Caused by: Project was never analyzed. A regular analysis is required before a branch analysis
16:50:31.301 ERROR:

The SonarQube Scanner did not complete successfully

16:50:31.34  Post-processing failed. Exit code: 1

D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\4.3.2\classic-sonar-scanner-msbuild\SonarScanner.MSBuild.exe failed with return code: 1 

(Nicolas Bontoux) #4

Hi Aaron,

Understood, however keep in mind that SonarQube’s logic is primarily independent from the CI tools it integrates with. Meaning that a common error in VSTS and Travis, could have a common root-cause and common solution. In this case here if you log at the root-cause in the stack you just shared:

Caused by: Project was never analyzed. A regular analysis is required before a branch analysis

It search matches this specific thread, and before anything I would therefore suggest to follow Fabrice’s advice:


(Aaron) #5

Well, again Travis doesn’t help with this. The issue is specific to the VSTS plugin configuration: How do I configure it? I already put in the key and the project name. And the project already exists. But still I get this error.


(Aaron) #6

I had my secret key in the “key” field rather than the project name, so I put the project name in there and now I have:
Failed to load the quality profiles of project '[unique key]': Component key '[unique key]' not found.

I have noticed that when I run it from the command line I specify the organization in addition to the key and login-key. Do I need to specify the org somehow in VSTS settings to make it recognize itself?


(Nicolas Bontoux) #7

Hey Aaron,

Specifying the org is important indeed. Do you confirm you’re using the SonarCloud extension for VSTS ? If so then setting the organization is an integral part of getting the build definition complete. Some good walkthrough on this Microsoft lab: https://aka.ms/sonarcloudlab (includes the below screenshot, showing the org setting).


(Aaron) #8

Do I use sonar.organization in the “Additional Properties” field? There is no “Organization” textbox like in the screen shot.


(Nicolas Bontoux) #9

Hence my question:

I’m double-checking that because a SonarQube extension also exists: https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Extension+for+VSTS-TFS

If you’re on SonarCloud then I strongly advise using the latest version of the SonarCloud Extension , and the tasks it provides (.e.g. Prepare Analysis on SonarCloud , as you can see in the screenshot).