gpt4 book ai didi

Jenkins 与 Sonar 集成不起作用

转载 作者:行者123 更新时间:2023-12-02 18:50:09 26 4
gpt4 key购买 nike

我使用的是 Jenkins 版本 2.7.1,目前与 Sonar 对话时遇到问题。我们的企业 Sonar 目前版本为 4.5.4,我们不允许更改此版本在 Jenkins 中我使用 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

问题:有谁知道我需要更改什么才能使其正常工作?

仅供引用 - 我在没有 jenkins 的情况下在本地尝试了此操作 - 只是运行 maven 命令并得到了相同的错误。

最佳答案

由于正确追踪此问题所需的详细信息超出了您通过问题描述实际提供的信息,因此以下是一些可能的故障排除路径:

  • 降级 Sonar Maven 插件:尽管 official documentation指出:

    From maven-sonar-plugin 2.7, SonarQube < 4.5 is no longer supported. If using SonarQube instance prior to 4.5, you should use maven-sonar-plugin 2.6.

    因此,您当前使用的插件确实应该支持版本 4.5.4 (org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.2),这可能是兼容性边缘情况,因此值得尝试早期版本。但请注意,早期的主要版本的 groupId 有不同的 Maven 协调(GAV、GroupId、ArtifactId、Version):org.codehaus.mojo:sonar-maven-plugin:jar:2.7.1

  • 检查代理设置:reported 已经出现了一个非常相似的错误(几乎相同的堆栈跟踪)。 (未经证实的)结论是:

    the error ... means that the response is probably corrupted by your proxy.

    Please compare original response (without using your proxy) and the one you get from the proxy.

关于 Jenkins 与 Sonar 集成不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38477873/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com