code: protected Plugin resolvePlugin( Plugin plugin, MavenProject project )
      {
  
          @SuppressWarnings( "unchecked" )
          List<ArtifactRepository> pluginRepositories = project.getPluginArtifactRepositories();
          Artifact artifact =
              factory.createPluginArtifact( plugin.getGroupId(), plugin.getArtifactId(),
                                            VersionRange.createFromVersion( "LATEST" ) );
  
          try
          {
              this.resolver.resolve( artifact, pluginRepositories, this.local );
              plugin.setVersion( artifact.getVersion() );
          }
          catch ( ArtifactResolutionException e )
          {
          }
          catch ( ArtifactNotFoundException e )
          {
          }
  
          return plugin;
      }
docs: Resolve plugin.
  
  @param plugin the plugin
  @param project the project
  @return the plugin