我想在SonarQube中使用StyleCop analyzer for Roslyn的规则,为了做到这一点并遵循建立的文档,我下载了SonarQube Roslyn SDK,并尝试为分析器生成插件以下命令:
RoslynSonarQubePluginGenerator /a:StyleCop.Analyzers /sqale:StyleCop.Analyzers.1.0.0.sqale.xml
它生成一个没有错误的LOG,但是会出现一个对话框告诉我文件没有出现,dos不再显示了。最后会显示以下消息:
Plugin generated: C:\Temp\SonarQube.Roslyn.SDK-1.0\stylecopanalyzers-plugin-1.0.0.jar
我将插件复制到C:\ Sonar \ sonarqube_5_6 \ extensions \ plugins并尝试启动SonarQube实例,但它失败了。以下日志显示在sonar.log文件中:
2016.10.07 15:35:18 ERROR web[o.a.c.c.C.[.[.[/]] Exception sending context initialized event to listener instance of class org.sonar.server.platform.PlatformServletContextListener
java.lang.IllegalStateException: Fail to instantiate class [org.sonar.plugins.roslynsdk.RoslynSdkGeneratedPlugin] of plugin [stylecopanalyzers]
at org.sonar.core.platform.PluginLoader.instantiatePluginClasses(PluginLoader.java:146) ~[sonar-core-5.6.1.jar:na]
at org.sonar.core.platform.PluginLoader.load(PluginLoader.java:73) ~[sonar-core-5.6.1.jar:na]
at org.sonar.server.plugins.ServerPluginRepository.loadInstances(ServerPluginRepository.java:288) ~[sonar-server-5.6.1.jar:na]
at org.sonar.server.plugins.ServerPluginRepository.start(ServerPluginRepository.java:117) ~[sonar-server-5.6.1.jar:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_65]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_65]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_65]
at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_65]
at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.invokeMethod(ReflectionLifecycleStrategy.java:110) ~[picocontainer-2.15.jar:na]
at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.start(ReflectionLifecycleStrategy.java:89) ~[picocontainer-2.15.jar:na]
at org.sonar.core.platform.ComponentContainer$1.start(ComponentContainer.java:320) ~[sonar-core-5.6.1.jar:na]
at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.start(AbstractInjectionFactory.java:84) ~[picocontainer-2.15.jar:na]
at org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:169) ~[picocontainer-2.15.jar:na]
at org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:132) ~[picocontainer-2.15.jar:na]
at org.picocontainer.behaviors.Stored.start(Stored.java:110) ~[picocontainer-2.15.jar:na]
at org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(DefaultPicoContainer.java:1016) ~[picocontainer-2.15.jar:na]
at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1009) ~[picocontainer-2.15.jar:na]
at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:767) ~[picocontainer-2.15.jar:na]
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:141) ~[sonar-core-5.6.1.jar:na]
at org.sonar.server.platform.platformlevel.PlatformLevel.start(PlatformLevel.java:84) ~[sonar-server-5.6.1.jar:na]
at org.sonar.server.platform.Platform.start(Platform.java:216) ~[sonar-server-5.6.1.jar:na]
at org.sonar.server.platform.Platform.startLevel2Container(Platform.java:182) ~[sonar-server-5.6.1.jar:na]
at org.sonar.server.platform.Platform.init(Platform.java:91) ~[sonar-server-5.6.1.jar:na]
at org.sonar.server.platform.PlatformServletContextListener.contextInitialized(PlatformServletContextListener.java:43) ~[sonar-server-5.6.1.jar:na]
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4812) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5255) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408) [tomcat-embed-core-8.0.32.jar:8.0.32]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398) [tomcat-embed-core-8.0.32.jar:8.0.32]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_65]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_65]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_65]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_65]
Caused by: java.lang.ClassNotFoundException: org.sonar.plugins.roslynsdk.RoslynSdkGeneratedPlugin
at org.sonar.classloader.ParentFirstStrategy.loadClass(ParentFirstStrategy.java:39) ~[sonar-classloader-1.0.jar:na]
at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:87) ~[sonar-classloader-1.0.jar:na]
at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:76) ~[sonar-classloader-1.0.jar:na]
at org.sonar.core.platform.PluginLoader.instantiatePluginClasses(PluginLoader.java:141) ~[sonar-core-5.6.1.jar:na]
... 32 common frames omitted
如果我打开jar文件,它只有一个META-INF文件夹
META-INF
|_lib
|_sslr-squid-bridge-2.6.jar
我已经下载了sonarqube-roslyn-sdk-template-plugin并放入了与SDK相同的文件夹,但行为仍然存在。
我错过了一步吗?我还需要其他什么吗?
答案 0 :(得分:0)
我下载了代码。在项目 SonarQube.Plugins.Roslyn.PluginGenerator.csproj 中 ArchiveUpdater ,特别是方法 ZipUsingShell ,添加文件时出错,它显示一个对话框。
作为一种解决方法,我采用temporal文件夹并手动创建.jar文件。我想深入了解,为什么它无法添加文件,但目前我很匆忙。
我想问题可能与我安装的7zip实例有关。