org.codehaus.mojo.versions.api
Interface VersionsHelper

All Known Implementing Classes:
DefaultVersionsHelper

public interface VersionsHelper

Helper class that provides common functionality required by both the mojos and the reports.

Since:
1.0-alpha-3
Author:
Stephen Connolly

Method Summary
 Artifact createDependencyArtifact(Dependency dependency)
          Shorthand method for getArtifactFactory().createDependencyArtifact(...) which extracts the parameters from the Dependency instance.
 Artifact createDependencyArtifact(String groupId, String artifactId, VersionRange version, String type, String classifier, String scope, boolean optional)
          Shorthand method for getArtifactFactory().createDependencyArtifact(...).
 Artifact createPluginArtifact(String groupId, String artifactId, VersionRange version)
          Shorthand method for getArtifactFactory().createPluginArtifact(...).
 Set extractArtifacts(Collection mavenProjects)
          Takes a List of MavenProject instances and converts it into a Set of Artifact instances.
 ArtifactFactory getArtifactFactory()
          Returns the artifact factory to use.
 Log getLog()
          Gets the logger used by this helper.
 Comparator getVersionComparator(Artifact artifact)
          Returns the version comparator to use for the specified artifact.
 Comparator getVersionComparator(String groupId, String artifactId)
          Returns the version comparator to use for the specified groupId and artifactId.
 ArtifactVersions lookupArtifactVersions(Artifact artifact, boolean usePluginRepositories)
          Looks up the versions of the specified artifact that are available in either the local repository, or the appropriate remote repositories.
 

Method Detail

getLog

Log getLog()
Gets the logger used by this helper.

Returns:
the logger used by this helper.

lookupArtifactVersions

ArtifactVersions lookupArtifactVersions(Artifact artifact,
                                        boolean usePluginRepositories)
                                        throws MojoExecutionException
Looks up the versions of the specified artifact that are available in either the local repository, or the appropriate remote repositories.

Parameters:
artifact - The artifact to look for versions of.
usePluginRepositories - true will consult the pluginRepositories, while false will consult the repositories for normal dependencies.
Returns:
The details of the available artifact versions.
Throws:
MojoExecutionException - When things go wrong.
Since:
1.0-alpha-3

getVersionComparator

Comparator getVersionComparator(Artifact artifact)
Returns the version comparator to use for the specified artifact.

Parameters:
artifact - the artifact.
Returns:
the version comparator to use.
Since:
1.0-alpha-3

getVersionComparator

Comparator getVersionComparator(String groupId,
                                String artifactId)
Returns the version comparator to use for the specified groupId and artifactId.

Parameters:
groupId - the groupId.
artifactId - the artifactId.
Returns:
the version comparator to use.
Since:
1.0-alpha-3

getArtifactFactory

ArtifactFactory getArtifactFactory()
Returns the artifact factory to use.

Returns:
the artifact factory to use.
Since:
1.0-alpha-3

createPluginArtifact

Artifact createPluginArtifact(String groupId,
                              String artifactId,
                              VersionRange version)
Shorthand method for getArtifactFactory().createPluginArtifact(...).

Parameters:
groupId - The group Id.
artifactId - The artifact Id.
version - The version range.
Returns:
the corresponding plugin artifact.
Since:
1.0-alpha-3

createDependencyArtifact

Artifact createDependencyArtifact(String groupId,
                                  String artifactId,
                                  VersionRange version,
                                  String type,
                                  String classifier,
                                  String scope,
                                  boolean optional)
Shorthand method for getArtifactFactory().createDependencyArtifact(...).

Parameters:
groupId - The group id.
artifactId - The artifact id.
version - The version (possibly a range)
type - The type.
classifier - The classifier.
scope - The scope.
optional - If optional or not.
Returns:
The corresponding dependency artifact.
Since:
1.0-alpha-3

createDependencyArtifact

Artifact createDependencyArtifact(Dependency dependency)
                                  throws InvalidVersionSpecificationException
Shorthand method for getArtifactFactory().createDependencyArtifact(...) which extracts the parameters from the Dependency instance.

Parameters:
dependency - The dependency to create the artifact for.
Returns:
The corresponding dependency artifact.
Throws:
InvalidVersionSpecificationException - if the version specified in the dependency is invalid.
Since:
1.0-alpha-3

extractArtifacts

Set extractArtifacts(Collection mavenProjects)
Takes a List of MavenProject instances and converts it into a Set of Artifact instances.

Parameters:
mavenProjects - the List of MavenProject instances.
Returns:
a Set of Artifact instances.
Since:
1.0-alpha-3


Copyright © 2008-2009 Codehaus. All Rights Reserved.