gabrie-allaigre / sonar-gitlab-plugin

Add to each commit GitLab in a global commentary on the new anomalies added by this commit and add comment lines of modified files
GNU Lesser General Public License v3.0
713 stars 207 forks source link

sonar.gitlab.project_id doesn't match project name #150

Closed michelebortolato closed 6 years ago

michelebortolato commented 6 years ago

hi i'm using "org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.0.905" with this command:

mvn -X sonar:sonar -B -Dsonar.analysis.mode=preview -Dsonar.gitlab.commit_sha=8f6b4946858696f7a7ba928c30d2d6b50daebcc3 -Dsonar.gitlab.project_id=my.project.path -Dsonar.gitlab.ref_name=develop

and the build doesn't work, for this problem:

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.0.905:sonar (default-cli) on project icss: Unable to load component class org.sonar.scanner.scan.ProjectLock: Unable to load component class org.sonar.scanner.scan.DefaultInputModuleHierarchy: Failed to execute project builder: com.talanlabs.sonar.plugins.gitlab.CommitProjectBuilder: Unable found project for my.project.path Verify Configuration sonar.gitlab.project_id or sonar.gitlab.user_token access project -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.0.905:sonar (default-cli) on project icss: Unable to load component class org.sonar.scanner.scan.ProjectLock
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
    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:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Unable to load component class org.sonar.scanner.scan.ProjectLock
    at org.sonarsource.scanner.maven.bootstrap.ScannerBootstrapper.execute(ScannerBootstrapper.java:65)
    at org.sonarsource.scanner.maven.SonarQubeMojo.execute(SonarQubeMojo.java:108)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
    ... 20 more

it works if is omitted "my.project.path" or if i use the numerical id of the project as sonar.gitlab.project_id property, it seems strange for me because i tried every kind of project path, i also get the json gitlab of my project and i am sure that i put the right name, i also tried

whitout any result, i don'have forced any kind of version of this plugin, i don't know how to use it properly, a couple of week ago everything was fine.

Thanks

cadrogui commented 6 years ago

dude, the log says:

Unable found project for my.project.path Verify Configuration sonar.gitlab.project_id

it seems that my.project.path is not a project id, if you're using static definition for testing, you must use the id, this is an integer or the path that you use for clone the repo.

regards.

michelebortolato commented 6 years ago

The name is correct because:

Thanks

cadrogui commented 6 years ago

if the project is private you need the gitlab user access token, in my testing I use:

-Dsonar.gitlab.project_id=git@git.company.com:Dashboard/myproject.git

michelebortolato commented 6 years ago

using sshUrl as you say works only if i omit the property sonar.gitlab.commit_sha, the error is always the same and seems related to the sha that i pass, i retrieve this from gitlab copying it, it is absolutely right.

This is a problem that affect all the project of my area, 2 weeks ago everything was fine

michelebortolato commented 6 years ago

It was a permission misconfiguration in gitlab, that token could not see any project.

Thanks for the support