Hi,
The azure devops analysis task works now, since upgrade to v 1.8.1, but the Run analysis task still fails for me:
==============================================================================
Task : Run Code Analysis
Description : Run scanner and upload the results to the SonarCloud server. Version : 1.6.3
Author : sonarsource
Help : This task is not needed for Maven and Gradle projects since the scanner should be run as part of the build.
##[error]Error: Could not find or load main class Api
Caused by: java.lang.ClassNotFoundException: Api
Error: Could not find or load main class Api
##[error]C:\Agent3_work_tasks\SonarCloudAnalyze_ce096e50-6155-4de8-8800-4221aaeed4a1\1.6.3\sonar-scanner\bin\sonar-scanner.bat failed with return code: 1
We are running into a similar problem. Here is a log with debug enabled:
##[debug]Evaluating condition for step: 'Run Code Analysis'
##[debug]Evaluating: SucceededNode()
##[debug]Evaluating SucceededNode:
##[debug]=> True
##[debug]Result: True
##[section]Starting: Run Code Analysis
==============================================================================
Task : Run Code Analysis
Description : Run scanner and upload the results to the SonarCloud server.
Version : 1.6.3
Author : sonarsource
Help : This task is not needed for Maven and Gradle projects since the scanner should be run as part of the build.
[More Information](http://redirect.sonarsource.com/doc/install-configure-scanner-tfs-ts.html)
==============================================================================
##[debug]agent.TempDirectory=/workspace/_temp
##[debug]loading inputs and endpoints
##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION
##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION
##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN
##[debug]loading SECRET_SYSTEM_ACCESSTOKEN
##[debug]loading SECRET_SONARQUBE_ENDPOINT
##[debug]loaded 5
##[debug]Agent.ProxyUrl=undefined
##[debug]Agent.CAInfo=undefined
##[debug]Agent.ClientCert=undefined
##[debug]Agent.SkipCertValidation=undefined
##[debug]SONARQUBE_SCANNER_MODE=CLI
##[debug]Absolute path for pathSegments: /workspace/_tasks/SonarCloudAnalyze_ce096e50-6155-4de8-8800-4221aaeed4a1/1.6.3,sonar-scanner,bin,sonar-scanner = /workspace/_tasks/SonarCloudAnalyze_ce096e50-6155-4de8-8800-4221aaeed4a1/1.6.3/sonar-scanner/bin/sonar-scanner
##[debug]which '/workspace/_tasks/SonarCloudAnalyze_ce096e50-6155-4de8-8800-4221aaeed4a1/1.6.3/sonar-scanner/bin/sonar-scanner'
##[debug]found: '/workspace/_tasks/SonarCloudAnalyze_ce096e50-6155-4de8-8800-4221aaeed4a1/1.6.3/sonar-scanner/bin/sonar-scanner'
##[debug]which '/workspace/_tasks/SonarCloudAnalyze_ce096e50-6155-4de8-8800-4221aaeed4a1/1.6.3/sonar-scanner/bin/sonar-scanner'
##[debug]found: '/workspace/_tasks/SonarCloudAnalyze_ce096e50-6155-4de8-8800-4221aaeed4a1/1.6.3/sonar-scanner/bin/sonar-scanner'
##[debug]system.debug=true
##[debug]/workspace/_tasks/SonarCloudAnalyze_ce096e50-6155-4de8-8800-4221aaeed4a1/1.6.3/sonar-scanner/bin/sonar-scanner arg: -X
##[debug]exec tool: /workspace/_tasks/SonarCloudAnalyze_ce096e50-6155-4de8-8800-4221aaeed4a1/1.6.3/sonar-scanner/bin/sonar-scanner
##[debug]arguments:
##[debug] -X
[command]/workspace/_tasks/SonarCloudAnalyze_ce096e50-6155-4de8-8800-4221aaeed4a1/1.6.3/sonar-scanner/bin/sonar-scanner -X
##[error]Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
##[debug]Processed: ##vso[task.logissue type=error;]Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
##[error]Error: Could not find or load main class Device
##[debug]Processed: ##vso[task.logissue type=error;]Error: Could not find or load main class Device
##[debug]Processed: Error: Could not find or load main class Device##vso[task.logissue type=error;]
##[debug]rc:1
##[debug]success:false
##[debug]task result: Failed
##[error]/workspace/_tasks/SonarCloudAnalyze_ce096e50-6155-4de8-8800-4221aaeed4a1/1.6.3/sonar-scanner/bin/sonar-scanner failed with return code: 1
##[debug]Processed: ##vso[task.issue type=error;]/workspace/_tasks/SonarCloudAnalyze_ce096e50-6155-4de8-8800-4221aaeed4a1/1.6.3/sonar-scanner/bin/sonar-scanner failed with return code: 1
##[debug]Processed: ##vso[task.complete result=Failed;]/workspace/_tasks/SonarCloudAnalyze_ce096e50-6155-4de8-8800-4221aaeed4a1/1.6.3/sonar-scanner/bin/sonar-scanner failed with return code: 1
##[section]Finishing: Run Code Analysis
Same issue here, seems to happen due to a (space) in the Sonar project name (not the key). Likely somewhere in the analyzer its passing the project name as an argument without quotes, thus “UI” in our case (Project “Lidarr UI”) is seen as a separate class or argument.
For us re-creating the project as LidarrUI fixed this.
We have same issue here, also seems like new task version is not used?!
[command]/home/vsts/work/_tasks/SonarQubeAnalyze_6d01813a-9589-4b15-8491-8164aeb38055/4.6.3/sonar-scanner/bin/sonar-scanner
##[error]Error: Could not find or load main class App
Error: Could not find or load main class App
##[error]/home/vsts/work/_tasks/SonarQubeAnalyze_6d01813a-9589-4b15-8491-8164aeb38055/4.6.3/sonar-scanner/bin/sonar-scanner failed with return code: 1
Same issue here. All our builds are failing. Productivity has plummeted. We can’t deploy new versions of our software. Testers can’t test staging builds.