-
Notifications
You must be signed in to change notification settings - Fork 209
Open
Description
Hi,
Just started using SonarQube and am trying to integrate with our GitLab, however having issues with what seems to be the GitLab integration.
I am also using GitLab Auth, and have installed the 4.1.0-SNAPSHOT.
Environment:
- GitLab: 11.7.0-ee
- SonarQube: 7.6.0.21501
- GitLab Auth: 1.3.2
- GitLab integration: 4.1.0-SNAPSHOT
16:45:54.319 INFO: ------------------------------------------------------------------------
16:45:54.319 INFO: EXECUTION FAILURE
16:45:54.319 INFO: ------------------------------------------------------------------------
16:45:54.319 INFO: Total time: 1:07.829s
16:45:54.396 INFO: Final Memory: 19M/281M
16:45:54.397 INFO: ------------------------------------------------------------------------
16:45:54.397 ERROR: Error during SonarQube Scanner execution
org.picocontainer.injectors.AbstractInjector$UnsatisfiableDependenciesException: com.talanlabs.sonar.plugins.gitlab.CommitPublishPostJob has unsatisfied dependency 'class com.talanlabs.sonar.plugins.gitlab.ReporterBuilder' for constructor 'public com.talanlabs.sonar.plugins.gitlab.CommitPublishPostJob(com.talanlabs.sonar.plugins.gitlab.GitLabPluginConfiguration,com.talanlabs.sonar.plugins.gitlab.SonarFacade,com.talanlabs.sonar.plugins.gitlab.CommitFacade,com.talanlabs.sonar.plugins.gitlab.ReporterBuilder)' from org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer@4b1d6571:585<[Immutable]:org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer@5a96081a:49<|
at org.picocontainer.injectors.ConstructorInjector.getGreediestSatisfiableConstructor(ConstructorInjector.java:191)
at org.picocontainer.injectors.ConstructorInjector.getGreediestSatisfiableConstructor(ConstructorInjector.java:110)
at org.picocontainer.injectors.ConstructorInjector.access$100(ConstructorInjector.java:51)
at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:331)
at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364)
at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56)
at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64)
at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91)
at org.picocontainer.DefaultPicoContainer.getLocalInstance(DefaultPicoContainer.java:606)
at org.picocontainer.DefaultPicoContainer.getComponents(DefaultPicoContainer.java:587)
at org.sonar.core.platform.ComponentContainer.getComponentsByType(ComponentContainer.java:290)
at org.sonar.scanner.bootstrap.AbstractExtensionDictionnary.completeScannerExtensions(AbstractExtensionDictionnary.java:82)
at org.sonar.scanner.bootstrap.AbstractExtensionDictionnary.getExtensions(AbstractExtensionDictionnary.java:77)
at org.sonar.scanner.bootstrap.AbstractExtensionDictionnary.getFilteredExtensions(AbstractExtensionDictionnary.java:67)
at org.sonar.scanner.bootstrap.PostJobExtensionDictionnary.selectPostJobs(PostJobExtensionDictionnary.java:42)
at org.sonar.scanner.postjob.PostJobsExecutor.execute(PostJobsExecutor.java:38)
at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:376)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:126)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:73)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
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.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
at com.sun.proxy.$Proxy0.execute(Unknown Source)
at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:185)
at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:137)
at org.sonarsource.scanner.cli.Main.execute(Main.java:111)
at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
at org.sonarsource.scanner.cli.Main.main(Main.java:61)
Test .gitlab-ci.yml
job:
SonarQube:
stage: sonar
image:
before_script:
- apt-get update && apt-get -y install wget unzip
- wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-3.3.0.1492-linux.zip
- unzip sonar-scanner-cli-3.3.0.1492-linux.zip
- export PATH=sonar-scanner-3.3.0.1492-linux/bin:$PATH
script:
- sonar-scanner -Dsonar.login=$SONAR_TOKEN -Dsonar.gitlab.project_id=$CI_PROJECT_PATH -Dsonar.gitlab.commit_sha=$CI_COMMIT_SHA -Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME -X
tags:
- docker
Any ideas?
Thanks
bartlibert, ripper2hl, MazafakaHamster, don-vip, dominikmontada and 5 more
Activity
Grannath commentedon Jan 30, 2019
No idea, but I have the same issue. I get it running from Gradle, with just a URL and login defined. So it should not even try to report anything on GitLab. The SonarQube installation is fresh, with just this and the SAML plugin installed.
Environment:
jangrewe commentedon Jan 30, 2019
#metoo with SonarQube 7.6 and plugin 4.0.0
lukaspj commentedon Jan 30, 2019
Can confirm.
SonarQube 7.6 plugin 4.0.0.
Tried compiling latest master version as well, but to no avail. It's peculiar that the unsatisfied dependency is an internal class.
Full stack-trace:
lukaspj commentedon Jan 30, 2019
I have tried compiling the GitLab plugin with both OpenJDK and OracleJDK 8, both give the same error.
What Java version are you guys using to run the Sonar Scanner?
I'm using OpenJDK 10, could that matter?
jangrewe commentedon Jan 30, 2019
On a sidenote, the FindBugs plugin has the same issue with the latest version(s), so i think this is an issue caused by SQ 7.6.
lukaspj commentedon Jan 30, 2019
Found a lead.
@ScannerSide has been deprecated since 7.6 (latest) and a new similar annotation has been created in a different package. Gonna try and use the new annotation and see if that works.
lukaspj commentedon Jan 30, 2019
Can confirm, using the new @ScannerSide annotation works.
Seems like they accidentally broke the functionality when they deprecated it.
lukaspj commentedon Jan 30, 2019
Created a bug-report on SonarSource community:
https://community.sonarsource.com/t/sonarqube-7-6-breaks-sonarside-annotation/6328
lawrence-c commentedon Jan 30, 2019
@lukaspj nice find! Any chance you can detail your work fix?
lukaspj commentedon Jan 30, 2019
Sure thing,
Basically just download the source code, find and replace
org.sonar.api.batch.ScannerSide
withorg.sonar.api.scanner.ScannerSide
And update Sonar version in pom.xml to 7.6
Compile and upload and done 👍
lukaspj commentedon Jan 30, 2019
Worth noting, this isn't a correct fix as such. Because it breaks backwards compatibility with previous versions of SonarQube. It should be fixed by SonarQube itself.
henryju commentedon Jan 31, 2019
Hi @lukaspj
In SonarQube 7.6 we have started getting rid of our historically high coupling with Maven modules. The change that is affecting you is https://jira.sonarsource.com/browse/SONAR-11486
Basically, prior to 7.6, the PostJob extension point was a module level component, but only executed on the root module, at the end of the analysis. Since we are progressively trying to get rid of modules, we have changed the PostJob extension point to a project level component.
In your situation, the problem is that your post job (
CommitPublishPostJob
) has a dependency on a custom component (ReporterBuilder
) and possibly others. Those components are annotatedorg.sonar.api.batch.ScannerSide
which means they are considered as module level components. Since IoC containers form a tree, project level components can't "see" module level ones.If you want to fix your plugin to support both SQ 7.6 and earlier versions, I think the easiest way is to make all your components project level, but not using the new
org.sonar.api.scanner.ScannerSide
annotation (as you noticed, it would break compatibility with < 7.6). Instead, you should use the old way, that is still supported: add@InstantiationStrategy(PER_BATCH)
on all your components that should be visible to the post job.Let me know if you need more informations.
15 remaining items
shark-horse commentedon Oct 4, 2019
Are we talking about a Maven build plugin used when we do the scan on the code, or the server-side plugin?
shark-horse commentedon Oct 4, 2019
For those as clueless as I was about this problem, we are talking about a plugin installed in the SonarQube server. To uninstall, go to <your_sonar_site>/admin/marketplace?filter=installed and look for "Gitlab." Click the Uninstall button for any Gitlab-related plugins. After a restart, you should be able to scan without getting the same error for the same reason (worked for me).
patsevanton commentedon Jan 6, 2020
Same error with SonarQube 7.9.2 and sonar-gitlab-plugin 4.0.0
sinattieng commentedon Mar 24, 2020
Any new about this bug?
I am using the last version of sonar-maven-plugin 3.7.0.1746 and I got this error :
ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar (default-cli) on project <project>: com.talanlabs.sonar.plugins.gitlab.CommitPublishPostJob has unsatisfied dependency 'class com.talanlabs.sonar.plugins.gitlab.ReporterBuilder' for constructor 'public com.talanlabs.sonar.plugins.gitlab.CommitPublishPostJob(com.talanlabs.sonar.plugins.gitlab.GitLabPluginConfiguration,com.talanlabs.sonar.plugins.gitlab.SonarFacade,com.talanlabs.sonar.plugins.gitlab.CommitFacade,com.talanlabs.sonar.plugins.gitlab.ReporterBuilder)' from org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer@353d5161:250<[Immutable]:org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer@70777b2:41<| -> [Help 1]
How can I pass through it? because the only side effect that I saw, it's about the status of my pipeline on gitlab but not on my sonar server, because the project has been scanned.
What should I do ?
Regards
jangrewe commentedon Mar 24, 2020
Why don't you guys just use SQ 8+? As far as i understand, it has all that functionality now built in.
https://www.sonarqube.org/gitlab-integration/
sinattieng commentedon Mar 24, 2020
Unfortunatelly, that integration is only for commercial edition and NOT for the community one, so I hope someone has solved the bug or I have just to wait for the next version of the maven plugin.
walidayada92 commentedon Apr 15, 2020
Remove any related plugin to gitlab at sonarqube and the issue will be solved
manid commentedon Jun 16, 2020
Could the 4.1.0 be released so the fix for this bug would be in a relea?
sinattieng commentedon Jun 30, 2020
I'm still having the same error using the sonar scanner maven plugin
ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar (default-cli) on project <project>: com.talanlabs.sonar.plugins.gitlab.CommitPublishPostJob has unsatisfied dependency 'class com.talanlabs.sonar.plugins.gitlab.ReporterBuilder' for constructor 'public com.talanlabs.sonar.plugins.gitlab.CommitPublishPostJob(com.talanlabs.sonar.plugins.gitlab.GitLabPluginConfiguration,com.talanlabs.sonar.plugins.gitlab.SonarFacade,com.talanlabs.sonar.plugins.gitlab.CommitFacade,com.talanlabs.sonar.plugins.gitlab.ReporterBuilder)' from org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer@353d5161:250<[Immutable]:org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer@70777b2:41<| -> [Help 1]
Any suggestion?
Stefano
yugj commentedon Jul 7, 2020
it is only in commercial version, but my boss seem does not want to pay for it
how can i get some open source solutions??
with sonar-gitlab-plugin 4.1.0 i got exception like:
my sornarqube version is :8.3 community edition
gitlab version: GitLab Community Edition 12.10.8
@gabrie-allaigre ? is this plugin support sonarqube 8.3 ?
need help, thanks alot
eugentius commentedon Aug 14, 2020
SonarQube 7.9.2
sonar-gitlab-plugin 4.0.0
sonar-maven-plugin:3.7.0.1746
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar (default-cli) on project test_project: com.talanlabs.sonar.plugins.gitlab.CommitPublishPostJob has unsatisfied dependency 'class com.talanlabs.sonar.plugins.gitlab.ReporterBuilder' for constructor 'public com.talanlabs.sonar.plugins.gitlab.CommitPublishPostJob(com.talanlabs.sonar.plugins.gitlab.GitLabPluginConfiguration,com.talanlabs.sonar.plugins.gitlab.SonarFacade,com.talanlabs.sonar.plugins.gitlab.CommitFacade,com.talanlabs.sonar.plugins.gitlab.ReporterBuilder)' from org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer@43631a3c:405<[Immutable]:org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer@17f9d4f4:63<| -> [Help 1]
sinattieng commentedon Aug 14, 2020
I have the same problem, I wish next version of maven plugin can solve it, or someonelse has a workaround?
ayunwSky commentedon Dec 7, 2020
I have the same problem about: [ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar (default-cli) on project cp-parking: com.talanlabs.sonar.plugins.gitlab.CommitPublishPostJob has unsatisfied dependency 'class com.talanlabs.sonar.plugins.gitlab.ReporterBuilder' for constructor 'public com.talanlabs.sonar.plugins.gitlab.CommitPublishPostJob(com.talanlabs.sonar.plugins.gitlab.GitLabPluginConfiguration,com.talanlabs.sonar.plugins.gitlab.SonarFacade,com.talanlabs.sonar.plugins.gitlab.CommitFacade,com.talanlabs.sonar.plugins.gitlab.ReporterBuilder)' from org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer@531a1bef:428<[Immutable]:org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer@6cd76944:55<| -> [Help 1]
I hope anyone can give a greate solution 。Thank you very much!
sinattieng commentedon Jan 25, 2021
Good evening,
I hope with the latest version the problem has been solved but unfortunately, I observed the same error:
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.8.0.2131:sonar (default-cli) on project ****: com.talanlabs.sonar.plugins.gitlab.CommitPublishPostJob has unsatisfied dependency 'class com.talanlabs.sonar.plugins.gitlab.ReporterBuilder' for constructor 'public com.talanlabs.sonar.plugins.gitlab.CommitPublishPostJob(com.talanlabs.sonar.plugins.gitlab.GitLabPluginConfiguration,com.talanlabs.sonar.plugins.gitlab.SonarFacade,com.talanlabs.sonar.plugins.gitlab.CommitFacade,com.talanlabs.sonar.plugins.gitlab.ReporterBuilder)' from org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer@15295502:274<[Immutable]:org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer@47ba1758:46<| -> [Help 1]
ChristianGmw commentedon Jan 25, 2021
New plugin version from this fork works for us: https://github.com/javamachr/sonar-gitlab-plugin