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 Details

    • getLog

      org.apache.maven.plugin.logging.Log getLog()
      Gets the logger used by this helper.
      Returns:
      the logger used by this helper.
    • getVersionComparator

      VersionComparator getVersionComparator(org.apache.maven.artifact.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

      VersionComparator 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
    • createPluginArtifact

      org.apache.maven.artifact.Artifact createPluginArtifact(String groupId, String artifactId, String version)
      Shorthand method for repositorySystem.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

      org.apache.maven.artifact.Artifact createDependencyArtifact(String groupId, String artifactId, String version, String type, String classifier, String scope, boolean optional)
      Shorthand method for repositorySystem.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

      org.apache.maven.artifact.Artifact createDependencyArtifact(org.apache.maven.model.Dependency dependency)
      Shorthand method for repositorySystem.createDependencyArtifact(...) which extracts the parameters from the Dependency instance.
      Parameters:
      dependency - The dependency to create the artifact for.
      Returns:
      The corresponding dependency artifact.
      Since:
      1.0-alpha-3
    • extractArtifacts

      Set<org.apache.maven.artifact.Artifact> extractArtifacts(Collection<org.apache.maven.project.MavenProject> 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
    • createArtifactVersion

      org.apache.maven.artifact.versioning.ArtifactVersion createArtifactVersion(String version)
      Creates an ArtifactVersion instance from a string.
      Parameters:
      version - the string representation of the version.
      Returns:
      The artifact version.
      Since:
      1.0-beta-1
    • lookupArtifactVersions

      ArtifactVersions lookupArtifactVersions(org.apache.maven.artifact.Artifact artifact, boolean usePluginRepositories) throws VersionRetrievalException
      Looks up the versions of the specified artifact that are available in either the local repository, or the appropriate remote repositories. The resulting ArtifactVersions instance will contain all versions, including snapshots.
      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:
      VersionRetrievalException - thrown if version resolution fails
      Since:
      1.0-alpha-3
    • lookupArtifactVersions

      ArtifactVersions lookupArtifactVersions(org.apache.maven.artifact.Artifact artifact, org.apache.maven.artifact.versioning.VersionRange versionRange, boolean usePluginRepositories, boolean useProjectRepositories) throws VersionRetrievalException
      Looks up the versions of the specified artifact that are available in either the local repository, or the appropriate remote repositories. The resulting ArtifactVersions instance will contain all versions, including snapshots.
      Parameters:
      artifact - The artifact to look for versions of.
      versionRange - versionRange to restrict the search, may be null
      usePluginRepositories - true will consult the pluginRepositories
      useProjectRepositories - true will consult regular project repositories
      Returns:
      The details of the available artifact versions.
      Throws:
      VersionRetrievalException - thrown if version resolution fails
      Since:
      2.15.0
    • lookupArtifactVersions

      ArtifactVersions lookupArtifactVersions(org.apache.maven.artifact.Artifact artifact, org.apache.maven.artifact.versioning.VersionRange versionRange, boolean usePluginRepositories) throws VersionRetrievalException
      Looks up the versions of the specified artifact that are available in either the local repository, or the appropriate remote repositories. The resulting ArtifactVersions instance will contain all versions, including snapshots.
      Parameters:
      artifact - The artifact to look for versions of.
      versionRange - versionRange to restrict the search, may be null
      usePluginRepositories - true will consult the pluginRepositories, while false will consult the repositories for normal dependencies.
      Returns:
      The details of the available artifact versions.
      Throws:
      VersionRetrievalException - thrown if version resolution fails
      Since:
      1.0-alpha-3
    • lookupDependenciesUpdates

      Map<org.apache.maven.model.Dependency,ArtifactVersions> lookupDependenciesUpdates(Stream<org.apache.maven.model.Dependency> dependencyStream, boolean usePluginRepositories, boolean allowSnapshots) throws VersionRetrievalException
      Returns a map of all possible updates per dependency. The lookup is done in parallel using LOOKUP_PARALLEL_THREADS threads.
      Parameters:
      dependencyStream - a stream of Dependency instances to look up.
      usePluginRepositories - Search the plugin repositories.
      allowSnapshots - whether snapshots should be included
      Returns:
      map containing the ArtifactVersions object per dependency
      Throws:
      VersionRetrievalException - thrown if a version cannot be retrieved
    • lookupDependenciesUpdates

      Map<org.apache.maven.model.Dependency,ArtifactVersions> lookupDependenciesUpdates(Stream<org.apache.maven.model.Dependency> dependencies, boolean usePluginRepositories, boolean useProjectRepositories, boolean allowSnapshots) throws VersionRetrievalException
      Returns a map of all possible updates per dependency. The lookup is done in parallel using LOOKUP_PARALLEL_THREADS threads.
      Parameters:
      dependencies - stream of Dependency instances to look up.
      usePluginRepositories - Search the plugin repositories.
      useProjectRepositories - whether to use regular project repositories
      allowSnapshots - whether snapshots should be included
      Returns:
      map containing the ArtifactVersions object per dependency
      Throws:
      VersionRetrievalException - thrown if a version cannot be retrieved
    • lookupDependencyUpdates

      ArtifactVersions lookupDependencyUpdates(org.apache.maven.model.Dependency dependency, boolean usePluginRepositories, boolean useProjectRepositories, boolean allowSnapshots) throws VersionRetrievalException
      Creates an ArtifactVersions instance from a dependency.
      Parameters:
      dependency - The dependency.
      usePluginRepositories - Search the plugin repositories.
      useProjectRepositories - whether to use regular project repositories
      allowSnapshots - whether snapshots should be included
      Returns:
      The details of updates to the dependency.
      Throws:
      VersionRetrievalException - thrown if version resolution fails
      Since:
      1.0-beta-1
    • lookupPluginsUpdates

      Map<org.apache.maven.model.Plugin,PluginUpdatesDetails> lookupPluginsUpdates(Stream<org.apache.maven.model.Plugin> plugins, boolean allowSnapshots) throws VersionRetrievalException
      Looks up the updates for a set of plugins.
      Parameters:
      plugins - A stream of Plugin instances to look up.
      allowSnapshots - Include snapshots in the list of updates.
      Returns:
      A map, keyed by plugin, with values of type PluginUpdatesDetails.
      Throws:
      VersionRetrievalException - thrown if version resolution fails
      Since:
      1.0-beta-1
    • lookupPluginUpdates

      PluginUpdatesDetails lookupPluginUpdates(org.apache.maven.model.Plugin plugin, boolean allowSnapshots) throws VersionRetrievalException
      Looks up the updates for a plugin.
      Parameters:
      plugin - The Plugin instance to look up.
      allowSnapshots - Include snapshots in the list of updates.
      Returns:
      The plugin update details.
      Throws:
      VersionRetrievalException - thrown if version resolution fails
      Since:
      1.0-beta-1
    • getExpressionEvaluator

      org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator getExpressionEvaluator(org.apache.maven.project.MavenProject project)
      Returns an ExpressionEvaluator for the specified project.
      Parameters:
      project - The project.
      Returns:
      an ExpressionEvaluator for the specified project.
      Since:
      1.0-beta-1
    • getVersionPropertiesMap

      Map<Property,PropertyVersions> getVersionPropertiesMap(VersionsHelper.VersionPropertiesMapRequest request) throws org.apache.maven.plugin.MojoExecutionException
      Returns a map of PropertyVersions values keyed by Property instances consisting of the properties defined in the project which are associated with version information.
      Parameters:
      request - VersionsHelper.VersionPropertiesMapRequest instance containing the arguments
      Returns:
      a map of PropertyVersions values keyed by Property instances.
      Throws:
      org.apache.maven.plugin.MojoExecutionException - if something goes wrong.
    • resolveArtifact

      void resolveArtifact(org.apache.maven.artifact.Artifact artifact, boolean usePluginRepositories) throws org.apache.maven.artifact.resolver.ArtifactResolutionException
      Attempts to resolve the artifact.
      Parameters:
      artifact - The artifact to resolve.
      usePluginRepositories - whether to resolve from the plugin repositories or the regular repositories.
      Throws:
      org.apache.maven.artifact.resolver.ArtifactResolutionException - if resolution is unsuccessful
      Since:
      1.3