Persistent storage

(Arnold Galovics) #1

Dear all,

I’m currently working on a plugin which would check some diff between two JSONs.
The implementation would do the following:
Load old version
Load new version
Do some diff calculation

Running the scanner would allow to access the new version but what about the old one? How can I access that data? Is there some persistent store in SonarQube which could be used for this purpose?
Actually the JSON is released into JAR artifacts so it’s possible to do some LATEST version downloading from Nexus/Artifactory but obviously that would mean that SonarQube have a coupling with the Maven2 repository.

Any feedback would be appreciated. :slight_smile:


Accessing previous version of file within a Plugin
(Arnold Galovics) #2

Any idea here?

Thanks in advance!

(G Ann Campbell) #3


SonarQube stores only one copy of the contents of a file - the most recent one. You’re not going to be able to get previous contents from SonarQube.


(Arnold Galovics) #4

Hi Ann,

Isn’t there any way to store a copy into the database with the custom plugin I’m trying to create? I’ve read somewhere that from 7.1, it’s not even possible to access the DB. :slight_smile:

Isn’t there any extension point for handling custom database tables?


(G Ann Campbell) #5

Hi Arnold,

There is no way for you to create or access (if you created them manually) custom tables. What you can do is store metrics, but the longer I think about using that to accomplish your goal, the more it seems like it would quickly lead to a hot mess. You should really consider some other way to accomplish this. Off-hand I’d say you should look into some other process that would check out the previous version, run your diff and prepare a report that your custom plugin would read and store as either metrics or issues (if you just have to get whatever it is you’re after into SonarQube).


(Arnold Galovics) #6

Hi Ann,

Thank you very much for the help, at least you could confirm that it’s not really possible.
Just out of curiosity, why isn’t there a way to handle custom tables in Sonar plugins?


(G Ann Campbell) #7

Hi Arnold,

Because the database is and must remain a black box.