Advertisement
Guest User

Untitled

a guest
Jul 19th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement