Monday, July 24, 2017

sonar-maven-plugin Insufficient privileges

When using "sonar-maven-plugin" as part of the jenkins build process, you might encounter this error message "[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.3.0.603:sonar (default-cli) on project service1-data: Insufficient privileges -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.3.0.603:sonar (default-cli) on project service1-data: Insufficient privileges
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
".

To fix this issue make sure that jenkins continuous integration (CI) job is building with correct projects' pom.xml in multi-module project. For example if your project has the following hierarchy
project/pom.xml
project/folder1/pom.xml
project/folder2/pom.xml

then if jenkins CI build is using project/pom.xml then
the sonar jenkins job (using sonar-maven-plugin) should also be using project/pom.xml

If the jenkins CI job is using project/pom.xml but sonar jenkins job is using different pom.xml say project/folder1/pom.xml then you will get above error.

No comments: