SHARE
TWEET

Untitled

a guest Jul 19th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class MyPlugin implements Plugin {
  2.     @Override
  3.     public void define(Context context) {
  4.         context.addExtension(MyPostAnalysisTask.class);
  5.     }
  6. }
  7.  
  8. public class MyPostAnalysisTask implements PostProjectAnalysisTask, Sensor {
  9.  
  10.     private String param = "";
  11.  
  12.     @Override
  13.     public void describe(SensorDescriptor descriptor) {
  14.         descriptor.name(getClass().getName());
  15.     }
  16.  
  17.     @Override
  18.     public void execute(SensorContext context) {
  19.         // Get command line param.
  20.         Optional<String> param = context.config().get('my.param.name');
  21.         if (param.isPresent()) {
  22.             this.param = param.get();
  23.         }
  24.     }
  25.  
  26.     @Override
  27.     public void finished(final ProjectAnalysis analysis) {
  28.         if (!this.param.isEmpty()) {
  29.             // Perform custom post analysis task.
  30.         }
  31.     }
  32. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top