code: protected Plugin findCurrentPlugin( Plugin plugin, MavenProject project )
      {
          Plugin found = null;
          try
          {
              Model model = project.getModel();
              @SuppressWarnings( "unchecked" )
              Map<String, Plugin> plugins = model.getBuild().getPluginsAsMap();
              found = plugins.get( plugin.getKey() );
          }
          catch ( NullPointerException e )
          {
              // nothing to do here
          }
  
          if ( found == null )
          {
              found = resolvePlugin( plugin, project );
          }
  
          return found;
      }
docs: Given a plugin, this will retrieve the matching plugin artifact from the model.
  
  @param plugin plugin to lookup
  @param project project to search
  @return matching plugin, <code>null</code> if not found.