org.apache.maven.project.artifact

## Class MavenMetadataSource

- java.lang.Object
- - AbstractLogEnabled
  - - org.apache.maven.project.artifact.MavenMetadataSource

- All Implemented Interfaces:
    ArtifactMetadataSource

      public class MavenMetadataSource
      extends AbstractLogEnabled
      implements ArtifactMetadataSource

  Version:
    $Id: MavenMetadataSource.java 736547 2009-01-22 03:57:09Z jdcasey $
  Author:
    Jason van Zyl, Brett Porter

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `ROLE_HINT`

    - ### Fields inherited from interface org.apache.maven.artifact.metadata.ArtifactMetadataSource

      `ROLE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MavenMetadataSource()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static java.util.Set` | `createArtifacts(ArtifactFactory artifactFactory, java.util.List dependencies, java.lang.String inheritedScope, ArtifactFilter dependencyFilter, MavenProject project)`
    `ResolutionGroup` | `retrieve(Artifact artifact, ArtifactRepository localRepository, java.util.List remoteRepositories)` Retrieve the metadata for the project from the repository.
    `java.util.List` | `retrieveAvailableVersions(Artifact artifact, ArtifactRepository localRepository, java.util.List remoteRepositories)` Get a list of available versions for an artifact in the remote repository
    `Artifact` | `retrieveRelocatedArtifact(Artifact artifact, ArtifactRepository localRepository, java.util.List remoteRepositories)` Resolve all relocations in the POM for this artifact, and return the new artifact coordinate.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### ROLE_HINT

          public static final java.lang.String ROLE_HINT

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### MavenMetadataSource

          public MavenMetadataSource()

  - ### Method Detail

    - #### retrieveRelocatedArtifact

          public Artifact retrieveRelocatedArtifact(Artifact artifact,
                                           ArtifactRepository localRepository,
                                           java.util.List remoteRepositories)
                                             throws ArtifactMetadataRetrievalException

      Resolve all relocations in the POM for this artifact, and return the new artifact coordinate.
      Specified by:
        `retrieveRelocatedArtifact` in interface `ArtifactMetadataSource`
      Throws:
        `ArtifactMetadataRetrievalException`

    - #### retrieve

          public ResolutionGroup retrieve(Artifact artifact,
                                 ArtifactRepository localRepository,
                                 java.util.List remoteRepositories)
                                   throws ArtifactMetadataRetrievalException

      Retrieve the metadata for the project from the repository. Uses the ProjectBuilder, to enable post-processing and inheritance calculation before retrieving the associated artifacts.
      Specified by:
        `retrieve` in interface `ArtifactMetadataSource`
      Throws:
        `ArtifactMetadataRetrievalException`

    - #### createArtifacts

          public static java.util.Set createArtifacts(ArtifactFactory artifactFactory,
                                      java.util.List dependencies,
                                      java.lang.String inheritedScope,
                                      ArtifactFilter dependencyFilter,
                                      MavenProject project)
                                               throws InvalidDependencyVersionException

      Returns:
        `Set` < `Artifact` >
      Throws:
        `InvalidDependencyVersionException`

    - #### retrieveAvailableVersions

          public java.util.List retrieveAvailableVersions(Artifact artifact,
                                                 ArtifactRepository localRepository,
                                                 java.util.List remoteRepositories)
                                                   throws ArtifactMetadataRetrievalException

      Description copied from interface: `ArtifactMetadataSource`
      Get a list of available versions for an artifact in the remote repository
      Specified by:
        `retrieveAvailableVersions` in interface `ArtifactMetadataSource`
      Parameters:
        `artifact` - artifact we are interested in. Only `groupid` and `artifactId` are needed, for instance the following code will work `artifactFactory.createProjectArtifact( "org.apache.maven", "maven", "" )`
        `localRepository` - local repository
        `remoteRepositories` - remote repositories, `List` $lt; `ArtifactRepository` >
      Returns:
        `List` $lt; `ArtifactVersion` >
      Throws:
        `ArtifactMetadataRetrievalException` - in case of error while retrieving repository metadata from the repository.