detekt / sonar-detekt

SonarQube plugin for Kotlin
https://detekt.dev
GNU Lesser General Public License v3.0
493 stars 52 forks source link

Plugin can be installed on not supported Sonar versions #152

Closed lst85 closed 2 years ago

lst85 commented 2 years ago

Hi,

We are using Sonar 8.9.1 (build 44547) and detekt plugin 2.3.0. In the marketplace I saw that there is an update available for the detekt plugin to version 2.4.0. After installing the update Sonar no longer starts. In the web.log file I can see the following line: Web server startup failed: Plugin detekt [detekt] requires at least SonarQube 9.1.0.47736

Is there a way to prevent installing 2.4.0 via the marketplace on Sonar versions that are not supported? In addition to that the README.md file says that the detekt plugin "Supports SonarQube 7.9.3+".

Side node: We would love to use the 2.4.0 version of the detekt plugin. However, updating Sonar is a major task because the Sonar installation is used company wide by a lot of projects. Is there any chance to get 2.4.0 running in Sonar 8.x?

EHEX-schildt commented 2 years ago

Same on latest LTS 8.9.6

cortinico commented 2 years ago

I'm afraid we would need someone with deeper understanding of SonarQube dependencies to pin point the problem here.

The version 2.4.0 of sonar-kotlin was released some months ago, with support for Detekt 1.18.x. I've update the information for the Sonar Update Center here: https://github.com/SonarSource/sonar-update-center-properties/pull/250#discussion_r762179676

In addition to that the README.md file says that the detekt plugin "Supports SonarQube 7.9.3+".

I believe that's still the case. The fact that SonarQube is preventing you to install the plugin is not necessarily a problem of this plugin.

Is there any chance to get 2.4.0 running in Sonar 8.x?

I believe it should work with 8.x as we declared 2.4.0.sqVersions=[8.9,LATEST]. Maybe you can open a thread on Sonar's forum and ask for further support?

lst85 commented 2 years ago

I think the problem is the Sonar API version in the Maven POM. detekt plugin 2.4.0 uses API version 9.1.0.47736: https://github.com/detekt/sonar-kotlin/blob/05f4c337bfb2b43fb1c15780da5bf5926960987d/pom.xml#L25 detekt plugin 2.3.0 uses API version 7.9.4: https://github.com/detekt/sonar-kotlin/blob/b8fd862bf159a263923b76ce6dd408037f5bb7e0/pom.xml#L25

cortinico commented 2 years ago

I think the problem is the Sonar API version in the Maven POM.

I'm unsure how the Sonar API bump are treated. I was under the assumption that we could bump the Sonar API and declare on the store the supported version of SonarQube we support. Seems like this is not the case (i.e. the POM file is effectively inspected at install time)?

Do you have some documentation on this front?

If this is the case, we would have to downgrade Sonar API to 8.x and release a newer version.

lst85 commented 2 years ago

https://docs.sonarqube.org/latest/extend/developing-plugin/

Minimal version of supported SonarQube at runtime. For example if value is 5.2, then deploying the plugin on versions 5.1 and lower will fail. Default value is given by the version of sonar-plugin-api dependency. It can be overridden with the Maven property sonarQubeMinVersion (since sonar-packaging-maven-plugin 1.16).

cortinico commented 2 years ago

This should address the issue https://github.com/detekt/sonar-kotlin/pull/153

cortinico commented 2 years ago

This should be solved by now with 2.5.0 being on the marketplace

lst85 commented 2 years ago

Thank you! :)