小编典典

Jenkins声纳检查失败:原因:java.lang.ClassNotFoundException:org.sonar.api.checks.NoSonarFilter

jenkins

当我打电话给詹金斯(Jenkins)构建工作时,它会引发以下错误而工作失败。

谁能看到这个错误?

詹金斯版本:1.642.1

声纳版本:5.4(Java插件3.5)

这是错误信息:

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.1:sonar (default-cli) on project ods-replicator: Unable to register extension org.sonar.plugins.java.JavaSquidSensor: Lorg/sonar/api/checks/NoSonarFilter;: org.sonar.api.checks.NoSonarFilter -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.1:sonar (default-cli) on project ods-replicator: Unable to register extension org.sonar.plugins.java.JavaSquidSensor
    ......
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.maven.plugin.MojoExecutionException: Unable to register extension org.sonar.plugins.java.JavaSquidSensor
    at org.sonarsource.scanner.maven.bootstrap.ExceptionHandling.handle(ExceptionHandling.java:36)
    at org.sonarsource.scanner.maven.bootstrap.RunnerBootstrapper.execute(RunnerBootstrapper.java:81)
    at org.sonarsource.scanner.maven.SonarQubeMojo.execute(SonarQubeMojo.java:112)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    ... 31 more
Caused by: java.lang.IllegalStateException: Unable to register extension org.sonar.plugins.java.JavaSquidSensor
    at org.sonar.core.platform.ComponentContainer.addExtension(ComponentContainer.java:241)
    ...
    ... 34 more
Caused by: java.lang.NoClassDefFoundError: Lorg/sonar/api/checks/NoSonarFilter;
    at java.lang.Class.getDeclaredFields0(Native Method)
    at java.lang.Class.privateGetDeclaredFields(Class.java:2583)
    at java.lang.Class.getDeclaredFields(Class.java:1916)
    at org.picocontainer.injectors.AdaptingInjection$2.run(AdaptingInjection.java:217)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.picocontainer.injectors.AdaptingInjection.injectionFieldAnnotated(AdaptingInjection.java:209)
    at org.picocontainer.injectors.AdaptingInjection.fieldAnnotatedInjectionAdapter(AdaptingInjection.java:188)
    at org.picocontainer.injectors.AdaptingInjection.createComponentAdapter(AdaptingInjection.java:57)
    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:239)
    ... 63 more
Caused by: java.lang.ClassNotFoundException: org.sonar.api.checks.NoSonarFilter
    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)
    ... 77 more
[ERROR] 
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

阅读 699

收藏
2020-07-25

共1个答案

小编典典

列出的Java插件3.5版的兼容性以5.1结尾。5.x系列中的API进行了更改,因此可以通过升级Java插件来解决。

2020-07-25