与声纳一起运行cobertura

时间:2015-06-19 07:35:02

标签: jenkins sonarqube maven-3 maven-cobertura-plugin

在使用声纳运行cobertura(安装在jenkins中的插件)时,我收到以下错误。 pom中的片段,错误和其他详细信息如下。有人可以帮忙吗?提前致谢。 Maven版本为3.0.4。 谷歌搜索后获得解决方案添加pom中的依赖。它仍然没有用  使用的目标是干净安装-U cobertura:cobertura声纳:声纳

   java.lang.TypeNotPresentException: Type org.codehaus.mojo.cobertura.CoberturaReportMojo not present
at org.eclipse.sisu.space.URLClassSpace.loadClass(URLClassSpace.java:115)
at org.eclipse.sisu.space.NamedClass.load(NamedClass.java:46)
at org.eclipse.sisu.space.AbstractDeferredClass.get(AbstractDeferredClass.java:48)
at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:86)
at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:55)
at com.google.inject.internal.ProviderInternalFactory$1.call(ProviderInternalFactory.java:70)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:100)
at org.eclipse.sisu.plexus.PlexusLifecycleManager.onProvision(PlexusLifecycleManager.java:133)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:109)
at com.google.inject.internal.ProvisionListenerStackCallback.provision(ProvisionListenerStackCallback.java:55)
at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:68)
at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:47)
at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:997)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1047)
at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:993)
at com.google.inject.Scopes$1$1.get(Scopes.java:59)
at org.eclipse.sisu.inject.LazyBeanEntry.getValue(LazyBeanEntry.java:82)
at org.eclipse.sisu.plexus.LazyPlexusBean.getValue(LazyPlexusBean.java:51)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:260)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:252)
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:459)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:97)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
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:317)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
  Caused by: java.lang.NoClassDefFoundError: org/apache/maven/reporting/AbstractMavenReport
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at      org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:389)
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:259)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:235)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:227)
at org.eclipse.sisu.space.URLClassSpace.loadClass(URLClassSpace.java:107)
... 41 more
  Caused by: java.lang.ClassNotFoundException: org.apache.maven.reporting.AbstractMavenReport
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:259)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:235)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:227)
... 56 more
[INFO]                                                                         
[INFO] ---------------------------------------------------------------------    ---
[INFO] Skipping -  List item

 IndexWeb
 [INFO] This project has been banned from the build due to previous failures.
 [INFO] ------------------------------------------------------------------------
 [INFO] ------------------------------------------------------------------------
 [INFO] Reactor Summary:
 [INFO] 
 [INFO] IndexWeb .................................... FAILURE [1.325s]
 [INFO] IndexWeb-webservices ........................ SKIPPED
 [INFO] IndexWeb-service ............................ SKIPPED
 [INFO] IndexWeb-web ................................ SKIPPED
 [INFO] ------------------------------------------------------------------------
 [INFO] BUILD FAILURE
 [INFO] ------------------------------------------------------------------------
 [INFO] Total time: 2.758s
 [INFO] Finished at: Fri Jun 19 06:39:11 UTC 2015
 [INFO] Final Memory: 12M/111M
 [INFO] ------------------------------------------------------------------------
 **[ERROR] Failed to execute goal org.codehaus.mojo:cobertura-maven-plugin:2.6:cobertura (default-cli) on project IndexWeb: Execution default-cli of goal org.codehaus.mojo:cobertura-maven-plugin:2.6:cobertura failed: Unable to load the mojo 'cobertura' in the plugin 'org.codehaus.mojo:cobertura-maven-plugin:2.6'. A required class is missing:   org/apache/maven/reporting/AbstractMavenReport**
  [ERROR] -----------------------------------------------------
  [ERROR] realm =    plugin>org.codehaus.mojo:cobertura-maven-plugin:2.6
  [ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
  [ERROR] urls[0] =    file:/home/jboss/.m2/repository/org/codehaus/mojo/cobertura-maven-plugin/2.6/cobertura-maven-plugin-2.6.jar
  [ERROR] urls[1] = file:/home/jboss/.m2/repository/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar
  [ERROR] Number of foreign imports: 1
  [ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
  [ERROR] 
  [ERROR] -----------------------------------------------------:      org.apache.maven.reporting.AbstractMavenReport
  [ERROR] -> [Help 1]
  [ERROR] 
   [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
  [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/PluginContainerException
   Build step 'Invoke top-level Maven targets' marked build as failure
   Archiving artifacts
   Skipping sonar analysis due to bad build status FAILURE

     <-- The snippet of pom below -->

   <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>cobertura-maven-plugin</artifactId>
       <version>2.6</version>
       <dependencies>
      <dependency>
        <groupId>org.apache.maven.reporting</groupId>
       <artifactId>maven-reporting-api</artifactId>
       <version>2.0.9</version>
       </dependency>
       </dependencies>
      </plugin>

1 个答案:

答案 0 :(得分:0)

看起来,有些测试花了一些时间/挂了一段时间。这是一次随机失败。

如果您想进行声纳分析,请使用此选项

  

-Dmaven.test.failure.ignore =真

这应该忽略失败并向您显示结果。让我事先告诉你,这只会有助于看到通过测试的分析。

只是一件事,我之前遇到了同样的问题。我们发现,这与redis缓存有关。我们修复它,它就像一个魅力,然后我们删除了我上面提到的选项。