code: public static PluginExecution getPluginGoalExecution(Plugin plugin, String goal) throws PluginScenarioException {
          List<PluginExecution> executions = plugin.getExecutions();
          
          for(Iterator<PluginExecution> iterator = executions.iterator(); iterator.hasNext();) {
              PluginExecution execution = (PluginExecution) iterator.next();
              if(execution.getGoals().contains(goal)) {
                  return execution;
              }
          }
          throw new PluginScenarioException("Could not find goal " + goal + " on plugin " + plugin.getKey());
      }
docs: Get an execution of a plugin
  @param plugin
  @param goal
  @return the execution object
  @throws PluginScenarioException