Maven plugin sonar-maven-plugin is not compatible with Java 17

This has been checked with the latest sonar-maven-plugin version

Given a project which generates Java 17 bytecode, by using 17 for the Maven compiler plugin, analyzing the project with the sonar-maven-plugin scanner will activate the Findbugs plugin and yields the following errors:

java.lang.IllegalArgumentException: Unsupported class file major version 61

After some research, I found that the sonar-maven-plugin uses version 4.0.3 of the sonar-findbugs-plugin internally.

This issue is supposedly fixed in spotbugs version 4.2.2 and later, see This newer version of spotbugs is used in sonar-findbugs-plugin version 4.0.4 and later, see When will sporbugs version 4.4.0 be supported? · Issue #376 · spotbugs/sonar-findbugs · GitHub

As of this writing, the latest version of the sonar-findbugs-plugin is 4.0.5
I am confident that updating the plugin to this version will enable Java 17 compatibility.

This is not quite true – the maven plugin doesn’t use the (community-supported) Findbugs plugins at all, but if a SonarQube server has the findbugs plugin installed, then the scanner will attempt to use it during analysis.

So you would need to update the plugin on your SonarQube server.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.