2016-07-20 153 views
3

我正在使用詹金斯版本2.7.1和我目前遇到與Sonar交談的問題。 我們的企業聲納是目前的版本爲4.5.4 我們不允許改變這個 在詹金斯,我使用Maven 3.3.9詹金斯聲納集成不工作

我得到的錯誤如下

 05:49:46 [INFO] SonarQube version: 4.5.4 
05:49:48 [INFO] Default locale: "en_US", source code encoding: "UTF-8" 
05:49:49 [INFO] [05:49:49.050] Load global referentials... 
05:49:49 [INFO] [05:49:49.185] Load global referentials done: 138 ms 
05:49:49 [INFO] ------------------------------------------------------------------------ 
05:49:49 [INFO] BUILD FAILURE 
05:49:49 [INFO] ------------------------------------------------------------------------ 
05:49:49 [INFO] Total time: 6.069 s 
05:49:49 [INFO] Finished at: 2016-07-20T05:49:49-04:00 
05:49:49 [INFO] Final Memory: 23M/237M 
05:49:49 [INFO] ------------------------------------------------------------------------ 
05:49:49 [ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.2:sonar (default-cli) on project services-web: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 -> [Help 1] 
05:49:49 org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.2:sonar (default-cli) on project services-web: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 
05:49:49 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212) 
05:49:49 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) 
05:49:49 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) 
05:49:49 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) 
05:49:49 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) 
05:49:49 at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) 
05:49:49 at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) 
05:49:49 at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) 
05:49:49 at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) 
05:49:49 at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) 
05:49:49 at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863) 
05:49:49 at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288) 
05:49:49 at org.apache.maven.cli.MavenCli.main(MavenCli.java:199) 
05:49:49 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
05:49:49 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
05:49:49 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
05:49:49 at java.lang.reflect.Method.invoke(Method.java:497) 
05:49:49 at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) 
05:49:49 at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) 
05:49:49 at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) 
05:49:49 at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) 
05:49:49 Caused by: org.apache.maven.plugin.MojoExecutionException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 
05:49:49 at org.sonarsource.scanner.maven.bootstrap.ExceptionHandling.handle(ExceptionHandling.java:36) 
05:49:49 at org.sonarsource.scanner.maven.bootstrap.ScannerBootstrapper.execute(ScannerBootstrapper.java:81) 
05:49:49 at org.sonarsource.scanner.maven.SonarQubeMojo.execute(SonarQubeMojo.java:112) 
05:49:49 at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) 
05:49:49 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207) 
05:49:49 ... 20 more 
05:49:49 Caused by: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 
05:49:49 at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:176) 
05:49:49 at com.google.gson.Gson.fromJson(Gson.java:803) 
05:49:49 at com.google.gson.Gson.fromJson(Gson.java:768) 
05:49:49 at com.google.gson.Gson.fromJson(Gson.java:717) 
05:49:49 at com.google.gson.Gson.fromJson(Gson.java:689) 
05:49:49 at org.sonar.batch.protocol.input.GlobalReferentials.fromJson(GlobalReferentials.java:70) 
05:49:49 at org.sonar.batch.referential.DefaultGlobalReferentialsLoader.load(DefaultGlobalReferentialsLoader.java:37) 
05:49:49 at org.sonar.batch.referential.GlobalReferentialsProvider.provide(GlobalReferentialsProvider.java:38) 
05:49:49 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
05:49:49 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
05:49:49 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
05:49:49 at java.lang.reflect.Method.invoke(Method.java:497) 
05:49:49 at org.picocontainer.injectors.MethodInjector.invokeMethod(MethodInjector.java:129) 
05:49:49 at org.picocontainer.injectors.MethodInjector.access$000(MethodInjector.java:39) 
05:49:49 at org.picocontainer.injectors.MethodInjector$2.run(MethodInjector.java:113) 
05:49:49 at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270) 
05:49:49 at org.picocontainer.injectors.MethodInjector.decorateComponentInstance(MethodInjector.java:120) 
05:49:49 at org.picocontainer.injectors.CompositeInjector.decorateComponentInstance(CompositeInjector.java:58) 
05:49:49 at org.picocontainer.injectors.Reinjector.reinject(Reinjector.java:142) 
05:49:49 at org.picocontainer.injectors.ProviderAdapter.getComponentInstance(ProviderAdapter.java:96) 
05:49:49 at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:698) 
05:49:49 at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:646) 
05:49:49 at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:631) 
05:49:49 at org.picocontainer.parameters.BasicComponentParameter$1.resolveInstance(BasicComponentParameter.java:118) 
05:49:49 at org.picocontainer.parameters.ComponentParameter$1.resolveInstance(ComponentParameter.java:136) 
05:49:49 at org.picocontainer.injectors.SingleMemberInjector.getParameter(SingleMemberInjector.java:78) 
05:49:49 at org.picocontainer.injectors.ConstructorInjector$CtorAndAdapters.getParameterArguments(ConstructorInjector.java:309) 
05:49:49 at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:335) 
05:49:49 at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270) 
05:49:49 at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364) 
05:49:49 at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56) 
05:49:49 at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64) 
05:49:49 at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91) 
05:49:49 at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:698) 
05:49:49 at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:646) 
05:49:49 at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:631) 
05:49:49 at org.picocontainer.parameters.BasicComponentParameter$1.resolveInstance(BasicComponentParameter.java:118) 
05:49:49 at org.picocontainer.parameters.ComponentParameter$1.resolveInstance(ComponentParameter.java:136) 
05:49:49 at org.picocontainer.injectors.SingleMemberInjector.getParameter(SingleMemberInjector.java:78) 
05:49:49 at org.picocontainer.injectors.SingleMemberInjector.getMemberArguments(SingleMemberInjector.java:61) 
05:49:49 at org.picocontainer.injectors.MethodInjector.getMemberArguments(MethodInjector.java:100) 
05:49:49 at org.picocontainer.injectors.MethodInjector$2.run(MethodInjector.java:112) 
05:49:49 at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270) 
05:49:49 at org.picocontainer.injectors.MethodInjector.decorateComponentInstance(MethodInjector.java:120) 
05:49:49 at org.picocontainer.injectors.CompositeInjector.decorateComponentInstance(CompositeInjector.java:58) 
05:49:49 at org.picocontainer.injectors.Reinjector.reinject(Reinjector.java:142) 
05:49:49 at org.picocontainer.injectors.ProviderAdapter.getComponentInstance(ProviderAdapter.java:96) 
05:49:49 at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:698) 
05:49:49 at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:646) 
05:49:49 at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:631) 
05:49:49 at org.picocontainer.parameters.BasicComponentParameter$1.resolveInstance(BasicComponentParameter.java:118) 
05:49:49 at org.picocontainer.parameters.ComponentParameter$1.resolveInstance(ComponentParameter.java:136) 
05:49:49 at org.picocontainer.injectors.SingleMemberInjector.getParameter(SingleMemberInjector.java:78) 
05:49:49 at org.picocontainer.injectors.ConstructorInjector$CtorAndAdapters.getParameterArguments(ConstructorInjector.java:309) 
05:49:49 at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:335) 
05:49:49 at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270) 
05:49:49 at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364) 
05:49:49 at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56) 
05:49:49 at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64) 
05:49:49 at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91) 
05:49:49 at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:698) 
05:49:49 at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:646) 
05:49:49 at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:631) 
05:49:49 at org.picocontainer.parameters.BasicComponentParameter$1.resolveInstance(BasicComponentParameter.java:118) 
05:49:49 at org.picocontainer.parameters.ComponentParameter$1.resolveInstance(ComponentParameter.java:136) 
05:49:49 at org.picocontainer.injectors.SingleMemberInjector.getParameter(SingleMemberInjector.java:78) 
05:49:49 at org.picocontainer.injectors.ConstructorInjector$CtorAndAdapters.getParameterArguments(ConstructorInjector.java:309) 
05:49:49 at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:335) 
05:49:49 at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270) 
05:49:49 at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364) 
05:49:49 at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56) 
05:49:49 at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64) 
05:49:49 at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91) 
05:49:49 at org.picocontainer.DefaultPicoContainer.instantiateComponentAsIsStartable(DefaultPicoContainer.java:1033) 
05:49:49 at org.picocontainer.DefaultPicoContainer.addAdapterIfStartable(DefaultPicoContainer.java:1025) 
05:49:49 at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1002) 
05:49:49 at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:766) 
05:49:49 at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92) 
05:49:49 at org.sonar.batch.bootstrapper.Batch.start(Batch.java:81) 
05:49:49 at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67) 
05:49:49 at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.executeOldVersion(BatchIsolatedLauncher.java:70) 
05:49:49 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
05:49:49 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
05:49:49 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
05:49:49 at java.lang.reflect.Method.invoke(Method.java:497) 
05:49:49 at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60) 
05:49:49 at com.sun.proxy.$Proxy23.executeOldVersion(Unknown Source) 
05:49:49 at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:245) 
05:49:49 at org.sonarsource.scanner.api.EmbeddedScanner.runAnalysis(EmbeddedScanner.java:151) 
05:49:49 at org.sonarsource.scanner.maven.bootstrap.ScannerBootstrapper.execute(ScannerBootstrapper.java:78) 
05:49:49 ... 23 more 
05:49:49 Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 
05:49:49 at com.google.gson.stream.JsonReader.beginObject(JsonReader.java:374) 
05:49:49 at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:165) 
05:49:49 ... 112 more 

問題:有人知道我需要改變才能使其工作嗎?

就像一個FYI - 我沒有jenkins在本地嘗試過 - 只是運行maven命令並得到相同的錯誤。

+1

在堆棧跟蹤中是否存在「由...引起」?如果是這樣,你應該[編輯]到問題 –

+0

有是的 - 我剛剛更新了問題 – Damien

回答

2

由於細節所需要的水平,以適當追查這個問題已經超出了你其實可以通過你的問題的說明提供,這裏有一些可能的解決疑難路徑:

  • 降級聲納Maven插件 :雖然official documentation指出:

    從Maven的聲納插件2.7,SonarQube < 4.5不再受支持。 如果在4.5之前使用SonarQube實例,則應該使用maven-sonar-plugin 2.6

    ,因此,版本4.5.4 確實由插件你目前正在使用(org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.2)的支持,它可能是一個兼容性的邊緣情況,因此值得一試的早期版本。但是請注意,早期主要版本有不同的Maven協調(GAV,GroupId的,artifactId的版本)爲其的groupId:org.codehaus.mojo:sonar-maven-plugin:jar:2.7.1

  • 檢查代理設置:一個非常類似的錯誤(幾乎相同的堆棧跟蹤)已經被reported和(未經證實)的結論是:

    錯誤...意味着響應可能被代理損壞。

    請比較原始回覆(不使用代理)和從代理獲得的回覆。