Overview
We, FRIDAY Insurance S.A, have implemented a Sonar plugin for the Gosu Programming Language. The plugin has been in internal use for a couple of years now and, as of 2023, we decided to open-source it.
We would like to include it in the marketplace, so other companies, mostly in the insurtech space, can use it as well.
Welcome to the community and congrats on your new plugin!
I want to let you know that I have a little backlog at the moment, so it will be a few days before I can look closely at this. But you’re on my list.
My SonarQube 9.9 server won’t start with your plugin. The error in web.log is this:
2023.04.10 12:26:02 INFO web[][o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.platform.web.WebServiceFilter@539316bb [pattern=UrlPattern{inclusions=[/api/system/migrate_db.*, ...], exclusions=[/api/components/update_key, ...]}]
2023.04.10 12:26:02 INFO web[][o.s.s.a.EmbeddedTomcat] HTTP connector enabled on port 9000
2023.04.10 12:26:02 INFO web[][o.s.s.p.DetectPluginChange] Detect plugin changes
2023.04.10 12:26:02 ERROR web[][o.s.s.p.Platform] Background initialization failed. Stopping SonarQube
java.lang.IllegalStateException: Fail to load plugin Community Gosu Plugin [communitygosu]
at org.sonar.server.plugins.ServerExtensionInstaller.installExtensions(ServerExtensionInstaller.java:81)
at org.sonar.server.platform.platformlevel.PlatformLevel4.start(PlatformLevel4.java:655)
at org.sonar.server.platform.PlatformImpl.start(PlatformImpl.java:196)
at org.sonar.server.platform.PlatformImpl.startLevel34Containers(PlatformImpl.java:177)
at org.sonar.server.platform.PlatformImpl$AutoStarterRunnable.runIfNotAborted(PlatformImpl.java:344)
at org.sonar.server.platform.PlatformImpl$1.doRun(PlatformImpl.java:105)
at org.sonar.server.platform.PlatformImpl$AutoStarterRunnable.run(PlatformImpl.java:328)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.NoClassDefFoundError: org/sonar/api/profiles/ProfileDefinition
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1012)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:524)
at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:427)
at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:421)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:712)
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:420)
at org.sonar.classloader.ClassRealm.loadClassFromSelf(ClassRealm.java:125)
at org.sonar.classloader.ParentFirstStrategy.loadClass(ParentFirstStrategy.java:37)
at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:87)
at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:76)
at de.friday.sonarqube.gosu.GosuPlugin.define(GosuPlugin.java:35)
at org.sonar.server.plugins.ServerExtensionInstaller.installExtensions(ServerExtensionInstaller.java:71)
... 7 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.sonar.api.profiles.ProfileDefinition
at org.sonar.classloader.ParentFirstStrategy.loadClass(ParentFirstStrategy.java:39)
at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:87)
at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:76)
... 21 common frames omitted
2023.04.10 12:26:02 INFO web[][o.s.p.ProcessEntryPoint] Hard stopping process
And in fact, in your PR, you’ve indicated that your plugin is only compatible with version 8.9. Unfortunately, 8.9 is officially EOL. I had been hoping this compatibility specification was an oversight on your part. That’s why I tried starting up with it anyway.
While I think your coverage for Gosu would be a great addition to the community ecosystem, unfortunately, I can’t add it to the marketplace until it’s compatible with at least the current LTS.
As a side note, while your plugin passes the bureaucratic requirements (thanks for having your ducks in a row!) you’ve overlooked the requirement to register your plugin’s properties file in the update-center-source.properties file.
I’m running Java 17 & getting this in analyzing the demo project you provided:
FAILURE: Build failed with an exception.
* Where:
Settings file '/home/anncampbell/testProjects/gosu/simple-gosu-project/settings.gradle'
* What went wrong:
Could not compile settings file '/home/anncampbell/testProjects/gosu/simple-gosu-project/settings.gradle'.
> startup failed:
General error during semantic analysis: Unsupported class file major version 61
java.lang.IllegalArgumentException: Unsupported class file major version 61
at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:196)
at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:177)
at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:163)
at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:284)
at org.codehaus.groovy.ast.decompiled.AsmDecompiler.parseClass(AsmDecompiler.java:81)
I haven’t used Gradle much, so my first though was that maybe I was running an old version, but I don’t actually seem to have it installed. It looks like ./gradlew uses what you ship in the project…?
One of the requirements to enter the Marketplace is that the plugin is “compatible with the platform requirements”. The requirements for 9.9 include analyzing with Java 11 or Java 17.
I’m trying to justify that it’s okay to not meet that requirement since Gosu developers naturally wouldn’t be analyzing with Java 17 if their compilation doesn’t support it…? (Help me out here, please.)
And while I ponder this question, I plan to switch JVMs and re-try the test.
I’ve opened an issue on the Gosu Lang repository asking if there’s a timeframe for it to support JDK 17. No answer so far. Although the plugin itself will work fine in a scanner using JDK 17, at the moment, is not possible to have a Gosu project with JDK 17 to run the scanner against.
We actually have implemented it. In fact, we used the Java implementation mentioned on the marketplace checklist as a reference to implement ours.
Of course! It was failing on the compile! I’ve switched back to Java 17 and skipped compile and it runs without errors. So we can cross this off the list.
Ehm… It was actually pretty naive: http://localhost:9000/api/measures/component?component=simple-gosu-project&metricKeys=ncloc,ncloc_data
Aaand… I see now that ncloc_data doesn’t come back for projects with natively-implemented langauges, so I’m checking internally on how best to validate this.
Sorry for the confusion. And I’ll come back when I’ve got more. Or by the end of the week. Whichever is sooner.