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

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

Related

Sonarqube Authentication Failure

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.

We have a case where there are multiple projects configured in sonar. All the project have different modules with same names?

We have a case where there are multiple projects configured in sonar. All the project have different modules with same names.
With this, as and when we execute sonar for one of the project, the execution is getting terminated with below error.
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.6:sonar (default-cli) on project XXX: Module "XXXX" is already part of project "YYYY" -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.6:sonar (default-cli) on project XXXX: Module "YYYY" is already part of project "YYYY"
It seems that because the module name is same , Sonar is terminating the execution. Note that we are using sonar version 4.5.5 and facing this issue. While earlier we were using sonar version 4.1.1 and with that version the execution was successful (probably sonar was overriding earlier report with the newer one in case of conflicting module name).
Please suggest possible solution for this? Thanks,
Complete error log is available here
https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/sonarqube/-L7cby77-28/6L6zPlb6AAAJ
I think you need to rename you modules like if your project is abc.
Please change your modules like abc_xxx etc...it may work for you
Have you tried using the project name property?
In a pom.xml file:
<sonar.projectName>Some project name here</sonar.projectName>

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.

jenkins - maven - sonar 3.7

we had
Jenkins 1.513 - Maven 3.0.5 - Sonar 3.5
combo setup for our projects.
After upgrading Sonar to version 3.7 i get the following error, on all projects:
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.1:sonar (default-cli) on project RC: Can not execute SonarQube analysis: Unable to execute Sonar: Task null does not exist -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.1:sonar (default-cli) on project RC: Can not execute SonarQube analysis
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
...
Caused by: org.apache.maven.plugin.MojoExecutionException: Can not execute SonarQube analysis
at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:109)
at org.codehaus.mojo.sonar.Bootstraper.start(Bootstraper.java:67)
at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:109)
...
Caused by: org.sonar.api.utils.SonarException: Task null does not exist
at org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:78)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:88)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:73)
Now, i get that it's a NullPointerException, but i couldn't find what/where to do to make things works again.
Any ideas would be appreciated :)
Thank you,
Marian
Ok, so obviously the error was human:
I should've understood, not just read this particular line:
If for any reason, has to change (moving the SonarQube distribution into another directory, generating the WAR and deploying it on different machines, etc.), set the SONAR_HOME environment variable to the new path to .
from the
Deploying SonarQube on Tomcat documentation.
Since I was doing an upgrade, i didn't want to remove the Sonar's old installation just yet, so i installed the new version in sonar-3.7 without updating the $SONAR_HOME variable which pointed to the /sonar folder (doh)
I found out after my initial post that the above mentioned error occured only when running SonarQube as webapp in Tomcat. In standalone mode, it was running fine.
Maybe this is one of the reasons why it is stated :
Note that the support of Tomcat will be dropped in version 4.1 of SonarQube.
Thus, it is highly recommended to stick with the standalone mode and not deploy SonarQube on Tomcat.
on the mentioned page.
It's easier to make an application more stupid proof just saying "don't do that" rather than fixing your own NullPointerExceptions. The only risk with this approach is that the stupid must understand what he's reading.

Issues in sonar analysis through Maven of php project

I am trying to do sonar analysis through maven of a php project.
I have gone followed all the instruction mentioned on http://docs.codehaus.org/display/SONAR/PHP+Plugin, have done all the necessary set up and changes mentioned.
I am getting following error messages after execution of the command mvn sonar:sonar from project directory.
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.0:sonar (d
efault-cli) on project espritKM: Can not execute Sonar: PHPMD execution failed w
ith returned code '255'. Please check the documentation of PHPMD to know more ab
out this failure. -> [Help 1]
In such case, you should run the analysis in Debug mode (i.e. with "-X") in order to find which exact PHPMD command is launched and then run it manually in a shell to see what's happening.

Resources