1

I have added an interface 'FileGenerator' as an extension point and implementation class 'JavaFileGenerator' is added implementing to the interface/extension point however the implementation class is not getting executed. I have below classes in my sonar plugin

  1. MyPlugin class implementing Plugin interface where I have registered my extension class 'JavaFileGenerator'
  2. FileGenerator is annotated with @ExtensionPoint, @BatchSide/@ServerSide
  3. In JavaFileGenerator class FileSystem is injected in constructor of the class

     public class MyPlugin implements Plugin {
      @Override
      public void define(Context context) {
       context.addExtension(JavaFileGenerator.class); }
    }
        @BatchSide
        @ExtensionPoint
         public interface FileGenerator {
            void generateFile();
         }
         public class JavaFileGenerator implements FileGenerator{
         private FileSystem fileSystem;
    
            public JavaFileGenerator(final FileSystem fileSystem){
                this.fileSystem=fileSystem; }
             @Override
             public void generateFile() { ... }
            }
    

JavaFileGenerator class does not get executed. Anybody has any idea about this?

4

1 回答 1

0

例如,对于客户端分析结束时的操作,您可以将插件编写为:

@BatchSide
public class XXXPostJob implements PostJob {

@Override
public void describe(PostJobDescriptor descriptor) {
    descriptor.name("-- post client side analyse sonarqube plugin --");
}

@Override
public void execute(PostJobContext context) {

// your business here ...

    }
于 2017-06-06T09:18:57.080 回答