Interface MavenDownloader

All Superinterfaces:
AutoCloseable, org.apache.camel.Service
All Known Implementing Classes:
MavenDownloaderImpl

public interface MavenDownloader extends org.apache.camel.Service
Pragmatic Maven download/resolution API that should replace usage of Ivy/Grape and Shrinkwrap across Camel.
  • Method Details

    • resolveArtifacts

      List<MavenArtifact> resolveArtifacts(String rootGav, List<String> dependencyGAVs, Set<String> extraRepositories, boolean transitively, boolean useApacheSnapshots) throws MavenResolutionException
      Main resolution method. Using Maven Resolver, a list of maven coordinates (in the form of groupId:artifactId[:packaging[:classifier]]:version) is used to download artifacts from configured Maven repositories.
      Parameters:
      rootGav - root Maven artifact
      dependencyGAVs - a list of Maven coordinates
      extraRepositories - nullable list of additional repositories to use (except the discovered ones)
      transitively - whether to download/resolve dependencies transitively
      useApacheSnapshots - whether to include Apache Snapshots repository in the list of used repositories
      Throws:
      MavenResolutionException
    • resolveArtifacts

      List<MavenArtifact> resolveArtifacts(List<String> dependencyGAVs, Set<String> extraRepositories, boolean transitively, boolean useApacheSnapshots) throws MavenResolutionException
      Throws:
      MavenResolutionException
    • resolveAvailableVersions

      List<MavenGav> resolveAvailableVersions(String groupId, String artifactId, String repository) throws MavenResolutionException
      Resolves available versions for groupId + artifactId from single remote repository.
      Parameters:
      groupId - groupId
      artifactId - artifactId
      repository - external repository to use (defaults to Maven Central if null)
      Throws:
      MavenResolutionException
    • customize

      MavenDownloader customize(String localRepository, int connectTimeout, int requestTimeout)
      Existing, configured MavenDownloader can be used as a template to create customized version which shares most of the configuration except underlying org.eclipse.aether.RepositorySystemSession, which can't be shared.
    • setRemoteArtifactDownloadListener

      void setRemoteArtifactDownloadListener(RemoteArtifactDownloadListener listener)
      To use a listener when downloading from remote repositories.
    • setFresh

      void setFresh(boolean fresh)
      Set a flag determining Maven update behavior. See the description of -U,--update-snapshots Maven option. When set to true, Maven metadata (to determine newest SNAPSHOT or RELEASE or LATEST version) is always fetched.
    • setOffline

      void setOffline(boolean offline)
      Sets maven downloader in offline mode
    • setRepos

      void setRepos(String repos)
      Configure comma-separated list of repositories to use (in addition to the ones discovered from Maven settings).
    • setMavenSettingsSecurityLocation

      void setMavenSettingsSecurityLocation(String mavenSettingsSecurity)
      Configure a location of settings-security.xml (when not set, defaults to ~/.m2/settings-security.xml unless setMavenSettingsLocation(String) is set explicitly set to "false".
    • setMavenSettingsLocation

      void setMavenSettingsLocation(String mavenSettings)
      Configure a location of settings.xml (when not set, defaults to ~/.m2/settings.xml unless it's explicitly set to "false".
    • getRepositoryResolver

      RepositoryResolver getRepositoryResolver()
      Gets the repository resolver.
    • setRepositoryResolver

      void setRepositoryResolver(RepositoryResolver repositoryResolver)
      Sets a custom repository resolver.
    • setMavenCentralEnabled

      void setMavenCentralEnabled(boolean mavenCentralEnabled)
      Sets whether maven central repository should be included and as first in the list of repositories. This can be used to turn of maven central for users that may use their own maven proxy.
    • isMavenCentralEnabled

      boolean isMavenCentralEnabled()
      Sets whether maven central repository should be included and as first in the list of repositories. This can be used to turn of maven central for users that may use their own maven proxy.
    • setMavenApacheSnapshotEnabled

      void setMavenApacheSnapshotEnabled(boolean mavenApacheSnapshotEnabled)
      Sets whether using SNAPSHOT versions of Apache Camel is enabled. If enabled then SNAPSHOT can be downloaded from the ASF SNAPSHOT maven repository.
    • isMavenApacheSnapshotEnabled

      boolean isMavenApacheSnapshotEnabled()
      Sets whether using SNAPSHOT versions of Apache Camel is enabled. If enabled then SNAPSHOT can be downloaded from the ASF SNAPSHOT maven repository.