public class DefaultVersionsHelper extends Object implements VersionsHelper
| Constructor and Description |
|---|
DefaultVersionsHelper(org.apache.maven.artifact.factory.ArtifactFactory artifactFactory,
org.apache.maven.artifact.resolver.ArtifactResolver artifactResolver,
org.apache.maven.artifact.metadata.ArtifactMetadataSource artifactMetadataSource,
List remoteArtifactRepositories,
List remotePluginRepositories,
org.apache.maven.artifact.repository.ArtifactRepository localRepository,
org.apache.maven.artifact.manager.WagonManager wagonManager,
org.apache.maven.settings.Settings settings,
String serverId,
String rulesUri,
org.apache.maven.plugin.logging.Log log,
org.apache.maven.execution.MavenSession mavenSession,
org.apache.maven.project.path.PathTranslator pathTranslator)
Constructs a new
DefaultVersionsHelper. |
| Modifier and Type | Method and Description |
|---|---|
org.apache.maven.artifact.versioning.ArtifactVersion |
createArtifactVersion(String version)
Creates an
ArtifactVersion instance from a string. |
org.apache.maven.artifact.Artifact |
createDependencyArtifact(org.apache.maven.model.Dependency dependency)
Shorthand method for
getArtifactFactory().createDependencyArtifact(...) |
org.apache.maven.artifact.Artifact |
createDependencyArtifact(String groupId,
String artifactId,
org.apache.maven.artifact.versioning.VersionRange versionRange,
String type,
String classifier,
String scope)
Shorthand method for
getArtifactFactory().createDependencyArtifact(...) |
org.apache.maven.artifact.Artifact |
createDependencyArtifact(String groupId,
String artifactId,
org.apache.maven.artifact.versioning.VersionRange versionRange,
String type,
String classifier,
String scope,
boolean optional)
Shorthand method for
getArtifactFactory().createDependencyArtifact(...) |
org.apache.maven.artifact.Artifact |
createPluginArtifact(String groupId,
String artifactId,
org.apache.maven.artifact.versioning.VersionRange versionRange)
Shorthand method for
getArtifactFactory().createPluginArtifact(...) |
Set<org.apache.maven.artifact.Artifact> |
extractArtifacts(Collection<org.apache.maven.project.MavenProject> mavenProjects)
|
org.apache.maven.artifact.factory.ArtifactFactory |
getArtifactFactory()
Returns the artifact factory to use.
|
protected Rule |
getBestFitRule(String groupId,
String artifactId)
Find the rule, if any, which best fits the artifact details given.
|
org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator |
getExpressionEvaluator(org.apache.maven.project.MavenProject project)
Returns an
ExpressionEvaluator for the specified project. |
org.apache.maven.plugin.logging.Log |
getLog()
Gets the logger used by this helper.
|
VersionComparator |
getVersionComparator(org.apache.maven.artifact.Artifact artifact)
Returns the version comparator to use for the specified artifact.
|
VersionComparator |
getVersionComparator(String groupId,
String artifactId)
Returns the version comparator to use for the specified groupId and artifactId.
|
Map<Property,PropertyVersions> |
getVersionPropertiesMap(org.apache.maven.project.MavenProject project,
Property[] propertyDefinitions,
String includeProperties,
String excludeProperties,
boolean autoLinkItems)
Returns a map of
PropertyVersions values keyed by
Property instances consisting of the properties defined in the project
which are associated with version information. |
ArtifactVersions |
lookupArtifactUpdates(org.apache.maven.artifact.Artifact artifact,
Boolean allowSnapshots,
boolean usePluginRepositories)
Looks up the updates of an artifact.
|
ArtifactVersions |
lookupArtifactVersions(org.apache.maven.artifact.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.
|
Map<org.apache.maven.model.Dependency,ArtifactVersions> |
lookupDependenciesUpdates(Set dependencies,
boolean usePluginRepositories)
Looks up the updates for a set of dependencies.
|
ArtifactVersions |
lookupDependencyUpdates(org.apache.maven.model.Dependency dependency,
boolean usePluginRepositories)
Creates an
ArtifactVersions instance from a dependency. |
Map<org.apache.maven.model.Plugin,PluginUpdatesDetails> |
lookupPluginsUpdates(Set<org.apache.maven.model.Plugin> plugins,
Boolean allowSnapshots)
Looks up the updates for a set of plugins.
|
PluginUpdatesDetails |
lookupPluginUpdates(org.apache.maven.model.Plugin plugin,
Boolean allowSnapshots)
Looks up the updates for a plugin.
|
void |
resolveArtifact(org.apache.maven.artifact.Artifact artifact,
boolean usePluginRepositories)
Attempts to resolve the artifact.
|
public DefaultVersionsHelper(org.apache.maven.artifact.factory.ArtifactFactory artifactFactory,
org.apache.maven.artifact.resolver.ArtifactResolver artifactResolver,
org.apache.maven.artifact.metadata.ArtifactMetadataSource artifactMetadataSource,
List remoteArtifactRepositories,
List remotePluginRepositories,
org.apache.maven.artifact.repository.ArtifactRepository localRepository,
org.apache.maven.artifact.manager.WagonManager wagonManager,
org.apache.maven.settings.Settings settings,
String serverId,
String rulesUri,
org.apache.maven.plugin.logging.Log log,
org.apache.maven.execution.MavenSession mavenSession,
org.apache.maven.project.path.PathTranslator pathTranslator)
throws org.apache.maven.plugin.MojoExecutionException
DefaultVersionsHelper.artifactFactory - The artifact factory.artifactResolver - artifactMetadataSource - The artifact metadata source to use.remoteArtifactRepositories - The remote artifact repositories to consult.remotePluginRepositories - The remote plugin repositories to consult.localRepository - The local repository to consult.wagonManager - The wagon manager (used if rules need to be retrieved).settings - The settings (used to provide proxy information to the wagon manager).serverId - The serverId hint for the wagon manager.rulesUri - The URL to retrieve the versioning rules from.log - The Log to send log messages to.mavenSession - The maven session information.pathTranslator - The path translator component. @throws org.apache.maven.plugin.MojoExecutionException
If things go wrong.org.apache.maven.plugin.MojoExecutionExceptionpublic org.apache.maven.artifact.factory.ArtifactFactory getArtifactFactory()
getArtifactFactory in interface VersionsHelperpublic org.apache.maven.plugin.logging.Log getLog()
getLog in interface VersionsHelperpublic ArtifactVersions lookupArtifactVersions(org.apache.maven.artifact.Artifact artifact, boolean usePluginRepositories) throws org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException
lookupArtifactVersions in interface VersionsHelperartifact - The artifact to look for versions of.usePluginRepositories - true will consult the pluginRepositories, while false
will consult the repositories for normal dependencies.org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException - When things go wrong.public void resolveArtifact(org.apache.maven.artifact.Artifact artifact,
boolean usePluginRepositories)
throws org.apache.maven.artifact.resolver.ArtifactResolutionException,
org.apache.maven.artifact.resolver.ArtifactNotFoundException
VersionsHelperresolveArtifact in interface VersionsHelperartifact - The artifact to resolve.usePluginRepositories - whether to resolve from the plugin repositories or the regular repositories.org.apache.maven.artifact.resolver.ArtifactResolutionExceptionorg.apache.maven.artifact.resolver.ArtifactNotFoundExceptionpublic VersionComparator getVersionComparator(org.apache.maven.artifact.Artifact artifact)
getVersionComparator in interface VersionsHelperartifact - the artifact.public VersionComparator getVersionComparator(String groupId, String artifactId)
getVersionComparator in interface VersionsHelpergroupId - the groupId.artifactId - the artifactId.protected Rule getBestFitRule(String groupId, String artifactId)
groupId - Group id of the artifactartifactId - Artifact id of the artifactpublic org.apache.maven.artifact.Artifact createPluginArtifact(String groupId, String artifactId, org.apache.maven.artifact.versioning.VersionRange versionRange)
getArtifactFactory().createPluginArtifact(...).createPluginArtifact in interface VersionsHelpergroupId - The group Id.artifactId - The artifact Id.versionRange - The version range.public org.apache.maven.artifact.Artifact createDependencyArtifact(String groupId, String artifactId, org.apache.maven.artifact.versioning.VersionRange versionRange, String type, String classifier, String scope, boolean optional)
getArtifactFactory().createDependencyArtifact(...).createDependencyArtifact in interface VersionsHelpergroupId - The group id.artifactId - The artifact id.versionRange - The version (possibly a range)type - The type.classifier - The classifier.scope - The scope.optional - If optional or not.public org.apache.maven.artifact.Artifact createDependencyArtifact(String groupId, String artifactId, org.apache.maven.artifact.versioning.VersionRange versionRange, String type, String classifier, String scope)
getArtifactFactory().createDependencyArtifact(...).createDependencyArtifact in interface VersionsHelpergroupId - The group id.artifactId - The artifact id.versionRange - The version range.type - The type.classifier - The classifier.scope - The scope.public org.apache.maven.artifact.Artifact createDependencyArtifact(org.apache.maven.model.Dependency dependency)
throws org.apache.maven.artifact.versioning.InvalidVersionSpecificationException
getArtifactFactory().createDependencyArtifact(...) which extracts the
parameters from the Dependency instance.createDependencyArtifact in interface VersionsHelperdependency - The dependency to create the artifact for.org.apache.maven.artifact.versioning.InvalidVersionSpecificationException - if the version specified in the dependency is invalid.public Set<org.apache.maven.artifact.Artifact> extractArtifacts(Collection<org.apache.maven.project.MavenProject> mavenProjects)
extractArtifacts in interface VersionsHelpermavenProjects - the List of MavenProject instances.Set of Artifact instances.public org.apache.maven.artifact.versioning.ArtifactVersion createArtifactVersion(String version)
ArtifactVersion instance from a string.createArtifactVersion in interface VersionsHelperversion - the string representation of the version.public ArtifactVersions lookupArtifactUpdates(org.apache.maven.artifact.Artifact artifact, Boolean allowSnapshots, boolean usePluginRepositories) throws org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException
lookupArtifactUpdates in interface VersionsHelperartifact - The artifact to look upallowSnapshots - Include snapshots in the list of updates.usePluginRepositories - Search the plugin repositories.org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException - When things go wrong.public Map<org.apache.maven.model.Dependency,ArtifactVersions> lookupDependenciesUpdates(Set dependencies, boolean usePluginRepositories) throws org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException, org.apache.maven.artifact.versioning.InvalidVersionSpecificationException
lookupDependenciesUpdates in interface VersionsHelperdependencies - The set of Dependency instances to look up.usePluginRepositories - Search the plugin repositories.ArtifactVersions.org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException - When things go wrong.org.apache.maven.artifact.versioning.InvalidVersionSpecificationExceptionpublic ArtifactVersions lookupDependencyUpdates(org.apache.maven.model.Dependency dependency, boolean usePluginRepositories) throws org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException, org.apache.maven.artifact.versioning.InvalidVersionSpecificationException
ArtifactVersions instance from a dependency.lookupDependencyUpdates in interface VersionsHelperdependency - The dependency.usePluginRepositories - Search the plugin repositories.org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException - When things go wrong.org.apache.maven.artifact.versioning.InvalidVersionSpecificationExceptionpublic Map<org.apache.maven.model.Plugin,PluginUpdatesDetails> lookupPluginsUpdates(Set<org.apache.maven.model.Plugin> plugins, Boolean allowSnapshots) throws org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException, org.apache.maven.artifact.versioning.InvalidVersionSpecificationException
lookupPluginsUpdates in interface VersionsHelperplugins - The set of Plugin instances to look up.allowSnapshots - Include snapshots in the list of updates.PluginUpdatesDetails.org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException - When things go wrong.org.apache.maven.artifact.versioning.InvalidVersionSpecificationExceptionpublic PluginUpdatesDetails lookupPluginUpdates(org.apache.maven.model.Plugin plugin, Boolean allowSnapshots) throws org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException, org.apache.maven.artifact.versioning.InvalidVersionSpecificationException
lookupPluginUpdates in interface VersionsHelperplugin - The Plugin instance to look up.allowSnapshots - Include snapshots in the list of updates.org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException - When things go wrong.org.apache.maven.artifact.versioning.InvalidVersionSpecificationException - if a version is invalid.public org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator getExpressionEvaluator(org.apache.maven.project.MavenProject project)
ExpressionEvaluator for the specified project.getExpressionEvaluator in interface VersionsHelperproject - The project.ExpressionEvaluator for the specified project.public Map<Property,PropertyVersions> getVersionPropertiesMap(org.apache.maven.project.MavenProject project, Property[] propertyDefinitions, String includeProperties, String excludeProperties, boolean autoLinkItems) throws org.apache.maven.plugin.MojoExecutionException
PropertyVersions values keyed by
Property instances consisting of the properties defined in the project
which are associated with version information.getVersionPropertiesMap in interface VersionsHelperproject - The project.propertyDefinitions - Any extra hints about properties.includeProperties - A comma separated list of properties to include.excludeProperties - A comma separated list of properties to exclude.autoLinkItems - whether to automatically infer associationsPropertyVersions values keyed by
Property instances.org.apache.maven.plugin.MojoExecutionException - if something goes wrong.Copyright © 2008-2014. All Rights Reserved.