sonar-maven-plugin停止在詹金斯工作

时间:2015-11-05 09:20:11

标签: maven jenkins sonarqube jenkins-plugins

一周前,我们所有的代码分析工作都停止使用您在本文末尾看到的错误消息。我们没有升级任何东西,它只是停止工作。我在jenkins日志中看到的唯一区别是,使用了不同版本的sonar-maven-plugin。之前是2.6,现在是2.7.1。我们不知道信息的来源。

我们的基础设施:

  • Jenkins 1.565.3
  • Jenkins Sonar Plugin 2.1
  • Sonarqube 3.1.1
  • Maven 3.0.3

我们没有关于放置在pom中的sonar-maven-plugin的信息。一切都由Jenkins Sonar插件处理。

我注意到代码分析工作的最后一次构建和它发展的第一次构建之间存在差异:

工作记录:

Downloading: https://artifactory.nepatec.de/repo/org/codehaus/mojo/sonar-maven-plugin/2.6/sonar-maven-plugin-2.6.pom

发送失败的构建消息:

Downloading: https://artifactory.nepatec.de/repo/org/codehaus/mojo/sonar-maven-plugin/2.7.1/sonar-maven-plugin-2.7.1.pom

我们不知道版本更改的来源,因为它没有在jenkins声纳插件中定义,我们也没有找到配置它的方法。

有谁知道,为什么版本跳转来自我们可以做什么,还原它?

Build始终失败,并出现以下异常:

05.11.2015 09:08:35 org.sonatype.guice.bean.reflect.NamedClass
WARNUNG: Error injecting: org.codehaus.mojo.sonar.SonarMojo
java.lang.TypeNotPresentException: Type org.codehaus.mojo.sonar.SonarMojo not present
    at org.sonatype.guice.bean.reflect.URLClassSpace.loadClass(URLClassSpace.java:100)
    at org.sonatype.guice.bean.reflect.NamedClass.load(NamedClass.java:45)
    at org.sonatype.guice.bean.reflect.AbstractDeferredClass.get(AbstractDeferredClass.java:47)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
    at com.google.inject.internal.InjectorImpl$4$1.call(InjectorImpl.java:968)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1014)
    at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:964)
    at com.google.inject.Scopes$1$1.get(Scopes.java:59)
    at org.sonatype.guice.bean.locators.LazyBeanEntry.getValue(LazyBeanEntry.java:79)
    at org.sonatype.guice.plexus.locators.LazyPlexusBean.getValue(LazyPlexusBean.java:53)
    at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:243)
    at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:235)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:455)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:92)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    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:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at    org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: java.lang.UnsupportedClassVersionError: org/codehaus/mojo/sonar/SonarMojo : Unsupported major.minor version 51.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:386)
    at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
    at org.sonatype.guice.bean.reflect.URLClassSpace.loadClass(URLClassSpace.java:96)
... 33 more

1 个答案:

答案 0 :(得分:3)

最新版本的Maven SonarQube插件至少需要Java 7,请参阅MSONAR-126

因此,您必须使用Java 7 +将Jenkins配置更新为至少(至少)SonaQube分析。