我正在尝试使用Sonar Runner对现有项目执行干运行分析,但它仍然使用java.lang.NoClassDefFoundError失败。我尝试过设置sonar.dryRun.excludePlugins =电子邮件通知,但这不能解决问题。
使用Sonar Runner 2.3,我的声纳版本为3.7.4
这是我的sonar-project.properties:
sonar.projectKey=com.example.company:testproject
sonar.projectName=Test Project
sonar.projectVersion=1.0
sonar.projectDescription=
sonar.language=grvy
sonar.sources=src
sonar.projectBaseDir=.
sonar.sourceEncoding=UTF-8
sonar.dryRun=true
这是堆栈跟踪:
Java 1.7.0_25 Oracle Corporation (64-bit)
Linux 2.6.32-358.14.1.el6.x86_64 amd64
INFO: Error stacktraces are turned on.
INFO: Runner configuration file: /sonar-runner/conf/sonar-runner.properties
INFO: Project configuration file: /workspace/sonar-project.properties
INFO: Default locale: "en_US", source code encoding: "UTF-8"
INFO: Work directory: /workspace/.sonar
INFO: SonarQube Server 3.7.4
09:44:21.156 INFO - Load batch settings
09:44:21.224 INFO - User cache: /home/user/.sonar/cache
09:44:21.228 INFO - Install plugins
09:44:21.234 INFO - Include plugins: buildbreaker
09:44:21.234 INFO - Exclude plugins: devcockpit, jira, pdfreport, views, report, scmactivity
09:44:21.268 INFO - Dry run
09:44:23.401 INFO - Create JDBC datasource for jdbc:h2:/tmp/sonar- batch356768803600806905223669976472392009/dryrun
09:44:24.675 INFO - Initializing Hibernate
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 5.528s
Final Memory: 8M/210M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
org.sonar.runner.impl.RunnerException: Unable to execute Sonar
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
at org.sonar.runner.api.Runner.execute(Runner.java:90)
at org.sonar.runner.Main.executeTask(Main.java:70)
at org.sonar.runner.Main.execute(Main.java:59)
at org.sonar.runner.Main.main(Main.java:41)
Caused by: java.lang.NoClassDefFoundError: org/sonar/plugins/emailnotifications/api/EmailTemplate
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:792)
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: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.sonar.plugins.core.CorePlugin.getExtensions(CorePlugin.java:411)
at org.sonar.batch.bootstrap.ExtensionInstaller.install(ExtensionInstaller.java:52)
at org.sonar.batch.bootstrap.TaskContainer.installTaskExtensions(TaskContainer.java:56)
at org.sonar.batch.bootstrap.TaskContainer.doBeforeStart(TaskContainer.java:45)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:90)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
at org.sonar.batch.bootstrap.BootstrapContainer.executeTask(BootstrapContainer.java:156)
at org.sonar.batch.bootstrap.BootstrapContainer.doAfterStart(BootstrapContainer.java:144)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
at org.sonar.batch.bootstrapper.Batch.startBatch(Batch.java:92)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:74)
at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:45)
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.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
... 9 more
Caused by: java.lang.ClassNotFoundException: org.sonar.plugins.emailnotifications.api.EmailTemplate
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
... 40 more`
答案 0 :(得分:0)
此插件是位于\ lib \ core-plugins中的核心插件,而不是您可以通过更新中心管理的插件,如位于\ extensions \ plugins中的插件。所以我认为你不能将它从sonar-project.properties中排除。
通常,您应该在所有项目上都有此问题(在此SonarQube安装下)。是吗?
在此项目之前是否有效,或者您是否同时做了一些事情,比如安装新版本?
如果您的jar文件版本不正确,我不会感到惊讶。也许重新安装它会起作用。
问候。