My team and I are currently working on a custom SonarQube plugin (with a custom set of rules) and we have the need to use some kind of post project analysis.
However, we are still stuck on it after some research and tests like trying to use the class made for it, PostProjectAnalysisTask, but we can’t manage to catch the javaFileScannerContext when doing a projectAnalysis.
We assume this scanner context is linked with the class we use to create rules : IssuableSubscriptionVisitor.
We are currently using SonarQube version 6.9 but we are planning on updating it. If a fix is possible without updating the plugin, please let us know.
Here are some snippets of our code :
// === Add JavaFileScannerContext === context.addExtension(JavaFileScannerContext.class); // === Add PostProjectAnalysisTask === context.addExtension(PostProjectAnalysisTaskJava.class);
ScannerContext scannerContext = context.getProjectAnalysis().getScannerContext();