2017-03-24 147 views
1

從Jenkins進行SonarQube掃描時遇到問題。見調試模式下的堆棧跟蹤:Jenkins的Sonarqube掃描:ClassNotFoundException:org.eclipse.jgit.api.Git

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar (default-cli) on project scbm-order-parent: Unable to register extension org.sonarsource.scm.git.JGitBlameCommand from plugin 'scmgit': org/eclipse/jgit/api/Git: org.eclipse.jgit.api.Git -> [Help 1] 
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar (default-cli) on project scbm-order-parent: Unable to register extension org.sonarsource.scm.git.JGitBlameCommand from plugin 'scmgit' 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216) 
    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:120) 
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347) 
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154) 
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:582) 
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214) 
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:158) 
    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 register extension org.sonarsource.scm.git.JGitBlameCommand from plugin 'scmgit' 
    at org.sonarsource.scanner.maven.bootstrap.ExceptionHandling.handle(ExceptionHandling.java:36) 
    at org.sonarsource.scanner.maven.bootstrap.ScannerBootstrapper.execute(ScannerBootstrapper.java:81) 
    at org.sonarsource.scanner.maven.SonarQubeMojo.execute(SonarQubeMojo.java:122) 
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) 
    ... 19 more 
Caused by: java.lang.IllegalStateException: Unable to register extension org.sonarsource.scm.git.JGitBlameCommand from plugin 'scmgit' 
    at org.sonar.core.platform.ComponentContainer.addExtension(ComponentContainer.java:249) 
    at org.sonar.scanner.bootstrap.ExtensionInstaller.doInstall(ExtensionInstaller.java:76) 
    at org.sonar.scanner.bootstrap.ExtensionInstaller.install(ExtensionInstaller.java:57) 
    at org.sonar.scanner.scan.ProjectScanContainer.addBatchExtensions(ProjectScanContainer.java:227) 
    at org.sonar.scanner.scan.ProjectScanContainer.doBeforeStart(ProjectScanContainer.java:115) 
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:141) 
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:128) 
    at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:47) 
    at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:86) 
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:143) 
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:128) 
    at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:118) 
    at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:117) 
    at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:62) 
    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.$Proxy31.execute(Unknown Source) 
    at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:233) 
    at org.sonarsource.scanner.api.EmbeddedScanner.runAnalysis(EmbeddedScanner.java:151) 
    at org.sonarsource.scanner.maven.bootstrap.ScannerBootstrapper.execute(ScannerBootstrapper.java:78) 
    ... 22 more 
Caused by: java.lang.NoClassDefFoundError: org/eclipse/jgit/api/Git 
    at java.lang.Class.getDeclaredMethods0(Native Method) 
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) 
    at java.lang.Class.getDeclaredMethods(Class.java:1975) 
    at org.picocontainer.injectors.AdaptingInjection$1.run(AdaptingInjection.java:203) 
    at java.security.AccessController.doPrivileged(Native Method) 
    at org.picocontainer.injectors.AdaptingInjection.injectionMethodAnnotated(AdaptingInjection.java:200) 
    at org.picocontainer.injectors.AdaptingInjection.methodAnnotatedInjectionAdapter(AdaptingInjection.java:171) 
    at org.picocontainer.injectors.AdaptingInjection.createComponentAdapter(AdaptingInjection.java:70) 
    at org.picocontainer.behaviors.AbstractBehaviorFactory.createComponentAdapter(AbstractBehaviorFactory.java:44) 
    at org.picocontainer.behaviors.OptInCaching.createComponentAdapter(OptInCaching.java:45) 
    at org.picocontainer.DefaultPicoContainer.addComponent(DefaultPicoContainer.java:536) 
    at org.picocontainer.DefaultPicoContainer.access$300(DefaultPicoContainer.java:84) 
    at org.picocontainer.DefaultPicoContainer$AsPropertiesPicoContainer.addComponent(DefaultPicoContainer.java:1149) 
    at org.sonar.core.platform.ComponentContainer.addExtension(ComponentContainer.java:247) 
    ... 44 more 
Caused by: java.lang.ClassNotFoundException: org.eclipse.jgit.api.Git 
    at org.sonar.classloader.ParentFirstStrategy.loadClass(ParentFirstStrategy.java:39) 
    at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:87) 
    at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:76) 
    ... 58 more 

二手版本:

  • 詹金斯1.624(好吧......舊的,但現在還不能升級)
  • 源與Java 8
  • Sonarqube掃描6.3(Git插件版本1.2,java插件版本4.6.0.8784)

從pom.xml中提取:

<pluginManagement> 
       <plugin> 
        <groupId>org.sonarsource.scanner.maven</groupId> 
        <artifactId>sonar-maven-plugin</artifactId> 
        <version>3.2</version> 
       </plugin> 
</pluginManagement> 

MVN命令行:

clean install -U -X org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar -Dsonar.host.url=http://x.x.x.x:9000 -Dsonar.working.directory=/tmp/.sonar/ -Dsonar.login=xxxxxxxxxxxxxx -DskipTests=true site 

任何想法?

我也嘗試添加了JGit神器在我的pom.xml的插件管理的一部分,沒有成功... :(

回答

1

好了,現在的工作。只是禁用的Git SCM插件。唐「知道爲什麼...... 然後禁用,因爲一個錯誤的聲納XML插件

Caused by: java.lang.ClassNotFoundException: org.sonar.squidbridge.api.AnalysisException 

如果有人知道爲什麼,請回答:)

我也看到有些人已經更新了Sonar Git插件中的JGit依賴版本:https://groups.google.com/forum/#!topic/sonarqube/TcRrB9XBk8o。 未測試...

1

我們遇到了與Sonarqube v5.6.7類似的問題。根本原因似乎是由聲納掃描器下載的插件庫的本地緩存損壞。 「/日誌/ SSC /聲納/緩存/緩存」 下找到

內容:

./675ef60911b1d93e17e84ab20261e18a 
./675ef60911b1d93e17e84ab20261e18a/sonar-xml-plugin-1.5-SNAPSHOT.jar_unzip 
./675ef60911b1d93e17e84ab20261e18a/sonar-xml-plugin-1.5-SNAPSHOT.jar_unzip/META-INF 
./675ef60911b1d93e17e84ab20261e18a/sonar-xml-plugin-1.5-SNAPSHOT.jar_unzip/META-INF/lib 

注意 「LIB」 目錄是空的。刪除「/ logs/ssc/sonar/cache/cache」緩存目錄的全部內容並運行另一個項目掃描導致它重新下載,並且lib目錄現在填充了該插件的依賴庫列表。

要找到插件罐的本地緩存存在的位置,我運行「strace -f -e trace = open,close,read,寫-o strace.log」,然後在「strace.log」中搜索插件名稱。

相關問題