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

时间:2016-03-16 08:42:21

标签: java jenkins sonarqube

当我调用Jenkins构建作业时,它会抛出以下错误并且作业失败。*

有人能看到这个错误吗?

詹金斯版本:1.642.1

Sonar版本: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

1 个答案:

答案 0 :(得分:4)

所列出的Java插件版本3.5的兼容性以5.1结尾。 5.x系列中有API更改,因此可以通过升级Java插件来解决这个问题。