Sonarqube Authentication Failure - sonarqube

I'm having a confusing problem with SonarQube 5.6 when trying to run an analysis with the sonar-maven-plugin 3.2 on a Java 8/Maven 3 project.
The error message is the following:
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin: 3.2:sonar (default-cli) on project YYY: Unable to execute SonarQube: Fail to download libraries from server: Status returned by url [XXX/sonarqube/batch_bootstrap/index] is not valid: [401] -> [Help 1]
The account I'm using has the permission "Execute Analysis" (it's in the group sonar-administrators) and the credentials are working when logging in via browser. Even the connection test of the SonarLint Eclipse plug-in was successful.

The problem was that I tried to reach the SonarQube server using an external URL instead of a local one. Seems to have to do with HTTPS or something like this. Using the local URL (http://sonarqube:9000/sonarqube) it now works.

Related

Error 409 Conflict when deploy with Jenkins in Anypoint Platform (CloudHub)

We deployed without problems in Anypoint Platform (CloudHub) using Jenkins. Now having problems.
The log shows that the answer is 409 Conflict when trying to deploy.
This is the exact error:
[ERROR] Failed: 409 Conflict: {"status": 409, "message": "Application not updated"}
[ERROR] Failed to deploy myApplicationName: Failed to deploy application myApplicationName
Also:
[ERROR] Failed to execute goal org.mule.tools.maven:mule-maven-plugin:2.2.1:deploy (deploy)
on project myApplicationName:
Failed to deploy [/usr/local/apache-tomcat-9.0.4/.jenkins/workspace/JDE System API/myApplicationName/
target/myApplicationName-1.0.6.zip] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal
As possible solutions we find changing the Maven to 2.2.1 but it is the one we are using.
Any solution?
Migrating to Mule Maven Plugin latest release for Mule 3.x (2.3.3) should resolve that issue. Note that migrating from earlier than 2.3.0 requires adapting the plugin configuration. The link above points to documentation.

sonar credential issue while running jenkins build

I am using Jenkins version 1.480.3 and Sonar version 3.4.1. I am executing Sonar analysis on my project using maven build option "sonar:sonar -PsonarJs" and below properties in jenkins:-
sonar.login=sonar
sonar.password=*****
sonar.host.connectTimeoutMs=300000
sonar.host.readTimeoutMs=600000
projectVersion=${projectVersion}
sonar.projectKey=abc
sonar.projectName=abc
sonar.projectVersion=${projectVersion}
sonar.sources=${MyPath)
sonar.branch=javascript
sonar.language=js
sonar.forceAnalysis=true
"sonar" is a local user created in Sonar.Upon firing the build in jenkins,sometimes my build fails with the following error:-
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.0:sonar (default-cli) on project vos-generic: Can not execute Sonar: Not authorized. Please check the properties sonar.login and sonar.password.
This is an intermittent error, sometimes the build fails with this error and sometimes it is successful.
I tried to resolve this error by creating a new local user "sonar1" in Sonar and adding it to the administrative group but got the same error again.
Any help is appreciated.Thanks in advance.

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

First time SONAR setup with Maven, getting a error on RulePriority, analysis fails

I am trying to setup SONAR on a server. I have Maven 3.0.3 and using Sonar 3.1.1 with a Java project.
Part way through the mvn sonar:sonar, I am getting the following error:
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.0:sonar (default-cli) on project XXXXXXX-common: Can not execute Sonar: No enum const class org.sonar.api.rules.RulePriority.3 -> [Help 1]
I have setup Sonar before and never saw this, it has always been unzip and go. But on this particular server I keep getting this error.
I tried creating a blank rule set, but the error still pops up.
Any thoughts?
I think you are facing the same problem described here
http://sonar.15.n6.nabble.com/Xpath-rules-gt-Failed-startup-of-context-td3183230.html
You might find it useful

Resources