wttech / AEM-Rules-for-SonarQube

SonarQube plugin with set of rules detecting possible bugs and bad smells specific for AEM development.
Apache License 2.0
116 stars 50 forks source link

Incompatible with new SonarJava 5.8 plugin (on SonarQube 7.3) #103

Closed MentalDisruptor closed 6 years ago

MentalDisruptor commented 6 years ago

When installed along with SonarJava 5.8 (Build 15699), Sonar analysis fails. I am getting this error during analysis:

15:18:31 [ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.3.0.603:sonar (default-cli) on project com.###.###.###: SonarQube is unable to analyze file : '/###/###/###.java': java.lang.reflect.InvocationTargetException: com.google.common.base.Preconditions.checkNotNull(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; -> [Help 1]

I am getting the very same error for each Java project that is analysed using SonarQube 7.3 / SonarJava 5.8 / AEM Rules for SonarQube 0.10 (and a snapshot build of 0.11 source from 10/19/2018)

Rolling back the SonarJava plugin to a previous release (5.7) fixes the issue (tested with a snapshot build of aEM Rules for SonarQube 0.11 of 10/19/2018).

fpavageau commented 6 years ago

See this thread on SonarSource Discourse for an analysis of the problem, and the solution: basePlugin needs to be removed from the configuration in pom.xml. I don't know if it impacts the minimum version of SonarQube, though.

chutch commented 6 years ago

Hi @MentalDisruptor @fpavageau

thanks for raising this issue. We will be investigating it shortly and will try proposed solution. Hope we can get back to you quickly with this one. For now, please stick with Java 5.7.

chutch commented 6 years ago

Hey @MentalDisruptor @fpavageau

we've just released version v0.11-RC1, which should be compatible with Java 5.8 and you'll also get some additional perks with it.

It would be great if you could test it in your project and report any false positive's for 2 new rules. We'll be testing it against our current projects and as long as it will behave stable, we'll release v0.11 to Marketplace.

fpavageau commented 6 years ago

In my test case, if I modify the Dockerfile to download https://github.com/Cognifide/AEM-Rules-for-SonarQube/releases/download/v0.11-RC1/aemrules-0.11-RC1.jar, SonarQube doesn't start:

2018.10.29 21:44:41 ERROR web[][o.s.s.p.Platform] Web server startup failed
java.lang.IllegalStateException: Unable to read plugin manifest from jar : /opt/sonarqube/extensions/plugins/aemrules-0.11-RC1.jar
    at org.sonar.updatecenter.common.PluginManifest.<init>(PluginManifest.java:125)
    at org.sonar.core.platform.PluginInfo.create(PluginInfo.java:395)
    at org.sonar.server.plugins.ServerPluginRepository.loadPreInstalledPlugins(ServerPluginRepository.java:135)
    at org.sonar.server.plugins.ServerPluginRepository.start(ServerPluginRepository.java:103)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.invokeMethod(ReflectionLifecycleStrategy.java:110)
    at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.start(ReflectionLifecycleStrategy.java:89)
    at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.start(AbstractInjectionFactory.java:84)
    at org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:169)
    at org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:132)
    at org.picocontainer.behaviors.Stored.start(Stored.java:110)
    at org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(DefaultPicoContainer.java:1016)
    at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1009)
    at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:767)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
    at org.sonar.server.platform.platformlevel.PlatformLevel.start(PlatformLevel.java:90)
    at org.sonar.server.platform.platformlevel.PlatformLevel2.start(PlatformLevel2.java:110)
    at org.sonar.server.platform.Platform.start(Platform.java:211)
    at org.sonar.server.platform.Platform.startLevel2Container(Platform.java:177)
    at org.sonar.server.platform.Platform.init(Platform.java:87)
    at org.sonar.server.platform.web.PlatformServletContextListener.contextInitialized(PlatformServletContextListener.java:45)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4745)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5207)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.util.zip.ZipException: error in opening zip file
    at java.util.zip.ZipFile.open(Native Method)
    at java.util.zip.ZipFile.<init>(ZipFile.java:225)
    at java.util.zip.ZipFile.<init>(ZipFile.java:155)
    at java.util.jar.JarFile.<init>(JarFile.java:166)
    at java.util.jar.JarFile.<init>(JarFile.java:130)
    at org.sonar.updatecenter.common.PluginManifest.<init>(PluginManifest.java:120)
    ... 32 common frames omitted
michaltobiasz commented 6 years ago

Hi @fpavageau, Thanks for response. We will look in this scenario and check whats going on.

michaltobiasz commented 6 years ago

Hi @fpavageau, I have tried to reproduce this issue. I have installed docker for Windows. I have build the container with aemrules-0.11-RC1.jar and run SonarQube. SonarQube started without any issue. Maybe this jar file was corrupted during a download. I would suggest to try manually download the file and add it to SonarQube extensions/plugins dir. I have some questions: Did you try more than one attempt to create the container and run SonarQube? On what system you are using docker?

fpavageau commented 6 years ago

Sorry for the false alarm, it works if you replace both instances of 0.10 by 0.11-RC1 in the release URL… Obviously it was too early for me to test.

It fixes the compatibility problem with SonarJava 5.8 for me. 👍

I don't have an AEM project to test it with at the moment though.

MentalDisruptor commented 6 years ago

Installed the plugin into a SonarQube 7.3 test instance that reflects the setup of our SonarQube production server. From what I can tell right now, the issue I observed in non-AEM Java projects is gone and analysis succeeds. I still need to test AEM project analysis and hope, that I can make it tomorrow. Otherwise, I cannot provide feedback any sooner than next week as I will not be able to test until Monday in that case.

MentalDisruptor commented 6 years ago

I've done the AEM project analysis test today and everything looks fine. Thanks for the fast response and fix, guys! 👍 🥇

chutch commented 6 years ago

Hey @MentalDisruptor 👍 great, thanks for checking this! I will try to perform release today.