Error during sonar runner execution - sonarqube

I set all properties. but when i run the sonar it shows error.
While it is working with another system which have same configuration.
The Error is below
error during sonar runner execution
fail to request server version
Caused by: Status returned by url:'http"//localhost:9000/api/server/version' is invalid :500

You don't specify whether you're using sonar-runner or Maven to run your analysis, but this looks like sonar.host.url may have a typo in it. Double-check that it's a valid, fully-formed URL.
EDIT:
For sonar-runner it's set in [install_directory]/conf/sonar-runner.properties
For Maven it's set in your settings.xml file

Related

Sonar scanner plugin installation

I have sonar-scanner-3.0.0.702 in local and sonar qube v5.3 in remote server.
In my sonar config property i have mentioned as like below.
sonar.host.url=https://example.com/sonar
sonar.token=a2s3d4f4k57
sonar.login=someuser
sonar.password=somepassword
sonar.language=abc,xyz
When I run the sonar scanner by executing ..\bin\sonar-scanner.bat. I can see the jar's are getting downloaded from site and saved under cache folder(C:\Users\John.sonar\cache). But my custom languages jar will not be downlaoded and hence it is throwing error saying
`ERROR: Error during SonarQube Scanner execution
ERROR: You must install a plugin that supports the language 'abc,xyz'
1) How can i plugin my custom JAR files in sonar scanner to make it work ?
Note : I know the procedure to include custom jar file in sonar Qube (sonarqube-5.3\extensions\plugins).But how can we do it for sonar scanner ?
2) In my conf file, i have mentioned sonar.token and sonar.password. if i remove the password i am getting authentication error. Why sonar scanner not using token for authorization ? how can we overcome this error ?
ERROR: Not authorized. Please check the properties sonar.login and sonar.password

NullPointerException when trying to create allure report by allure-jenkins-plugin

When I try to create allure report by allure-jenkins-plugin I get such error:
ERROR: Publisher ru.yandex.qatools.allure.jenkins.AllureReportPublisher aborted due to exception
java.io.IOException: java.lang.NullPointerException
at ru.yandex.qatools.allure.jenkins.utils.ReportGenerator.invoke(ReportGenerator.java:50)
at ru.yandex.qatools.allure.jenkins.utils.ReportGenerator.invoke(ReportGenerator.java:25)
at hudson.FilePath.act(FilePath.java:991)
at hudson.FilePath.act(FilePath.java:969)
at ru.yandex.qatools.allure.jenkins.AllureReportPublisher.generateReport(AllureReportPublisher.java:267)
at ru.yandex.qatools.allure.jenkins.AllureReportPublisher.perform(AllureReportPublisher.java:146)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:764)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:724)
at hudson.model.Build$BuildExecution.post2(Build.java:185)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:671)
at hudson.model.Run.execute(Run.java:1769)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:374)
Caused by: java.lang.NullPointerException
at ru.yandex.qatools.clay.internal.AetherUtils.getRepositoriesAsList(AetherUtils.java:183)
at ru.yandex.qatools.clay.Aether.<init>(Aether.java:60)
at ru.yandex.qatools.clay.Aether.aether(Aether.java:78)
at ru.yandex.qatools.allure.jenkins.utils.ReportGenerator.createAether(ReportGenerator.java:69)
at ru.yandex.qatools.allure.jenkins.utils.ReportGenerator.invoke(ReportGenerator.java:45)
... 14 more
xml-file created by allure is valid (I may create correct report with maven goal "site" with the same xml), so the problem must be in jenkins plugin.
I have maven 3.2.5 installed, settings.xml exists in ~/.m2 directory and seems to be correct.
What may be the reason of such error? Seems that it's somehow connected with maven settings.
It might happen due to :
Allure is not installed in the Jenkin.
STEPS:
Go to Manage Jenkins >
Global Tool Configuration >
Allure Commandline >
Add Allure Commandline >
Uncheck "Install automatically"
Download the latest allure commandline from maven repo - https://repo.maven.apache.org/maven2/io/qameta/allure/allure-commandline/
Unzip the file and provide the location
Installation directory : C:\allure-2.17.2 (I am using windows, jenkin)
The problem was in maven settings.xml file, in
<activeProfiles>
section. It contained profile, that in fact didn't exist. Removing this profile solved the problem.

Jenkins Sonar execution misses maven build-helper parse-version properties

My projects are built with Maven 3.0 and use the plugin build-helper to set the following properties at the initialization phase :
parsedVersion.majorVersion, parsedVersion.minorVersion
It works well for the build, where I also set sonar.branch=parsedVersion.majorVersion.parsedVersion.minorVersion
In Jenkins, I add the Post Build Step "Sonar analysis" (from Sonar plugin for Jenkins), it ends up with the following error:
Can not execute SonarQube analysis: Illegal character in query at index 108:
http://<sonar url>/sonar/batch_bootstrap/properties?project=com.x.y.<ArtifactId>:${parsedVersion.majorVersion}.${parsedVersion.minorVersion}
So the properties values were not instanciated correctly.
Did anyone encounter the issue ? is there a solution or is it a bug in Jenkins or Jenkins sonar plugin ?
You need to explicitly run the initialization phase.
Include -Dsonar.phase=initialize in your additional properties.

SonarQube - Jenkins - Maven - without running instance

I am running my analysis with Maven, triggered by a Jenkins job. As a DBMS i am using MySQL thats running on the same server as Jenkins does but my sonar instance is running on my local machine (connected to the MySQL DB). I don't want to run it on the server, yet. I would prefer to not run it at all for the time being.
Is it possible to run the analysis without a running sonar instance? Why do I have to configure the server URL (the login too) in both, the Jenkins plugin and the pom.xml?
The described architecture on SonarQube Platform Overview indicates that the analyser and server are not directly connected (only via DB).
When i try to run the analysis from Jenkins with no Server URI the build process is throwing the following message:
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.2:sonar (default-cli) on project xxx: SonarQube server can not be reached at http://localhost:9000. Please check the parameter 'sonar.host.url'. Connection refused -> [Help 1]
Thats exactly what i expected, he is trying to connect to the SonarQube instance that i did not want to run.
You don't have to configure the URL to Sonar in the POM if you are using the Sonar plugin to push results to Sonar.
Sonar 'instance' you are referring to is for you to visually see the post code analysis result. If you don't have the Sonar UI web application installed, code analysis is still run by Maven either through Jenkins or your IDE or in the command prompt/shell.

Maven with sonar authentication

I am running maven with sonar. Since I activated authentication on sonar for security purposes, since then I got the following error:
[ERROR] Can´t access to Sonar or project doesn't exist on Sonar instance. HTTP KO to http://localhost:9000/api/resources?resource=com.myproject.soft:soft&depth=0&format=xml
java.io.IOException: Can´t access to Sonar or project doesn't exist on Sonar instance.
at org.sonar.report.pdf.util.SonarAccess.getUrlAsDocument(SonarAccess.java:132)
at org.sonar.report.pdf.entity.Project.initializeProject(Project.java:98)
according to http://docs.sonarqube.org/display/SONAR/Analyzing+with+Maven I should use the following parameters:
-Dsonar.login=login -Dsonar.password=password
Those settings are not working for me.
The full command I am using is:
mvn install sonar:sonar -Dsonar.login=login -Dsonar.password=password
This is a limitation of the PDF Report Plugin that is developed by Klicap:
http://jira.codehaus.org/browse/SONARPLUGINS-1510
If you remove this plugin, then everything should be back to normal.
We have the same problem and resolved it by adding some credentials. Tested on Sonar 3.7 and Sonar PDF Plugin 1.3
In eclipse put this as your maven Goals:
org.codehaus.sonar-plugins.pdf-report:maven-pdfreport-plugin:1.3:generate -Dsonar.host.url=http://localhost:9000 -Dreport.type=executive -Dsonar.pdf.username=admin -Dsonar.pdf.password=admin

Resources