Class MavenDownloaderImpl

java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.support.service.ServiceSupport
org.apache.camel.tooling.maven.MavenDownloaderImpl
All Implemented Interfaces:
AutoCloseable, org.apache.camel.Service, org.apache.camel.ShutdownableService, org.apache.camel.StatefulService, org.apache.camel.SuspendableService, MavenDownloader

public class MavenDownloaderImpl extends org.apache.camel.support.service.ServiceSupport implements MavenDownloader
The only class in Camel that deals with all these DI mechanisms of maven-resolver library.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    static final org.slf4j.Logger
     
    static final String
     

    Fields inherited from class org.apache.camel.support.service.BaseService

    BUILT, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTING_DOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    protected void
     
    protected void
     
    protected void
     
    resolveArtifacts(List<String> dependencyGAVs, Set<String> extraRepositories, boolean transitively, boolean useApacheSnapshots)
    Main resolution method.
    resolveAvailableVersions(String groupId, String artifactId, String repository)
    Resolves available versions for groupId + artifactId from single remote repository.
    void
    setFresh(boolean fresh)
    Set a flag determining Maven update behavior.
    void
    Configure a location of settings.xml (when not set, defaults to ~/.m2/settings.xml unless it's explicitly set to "false".
    void
    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".
    void
    To use a listener when downloading from remote repositories.
    void
    Configure comma-separated list of repositories to use (in addition to the ones discovered from Maven settings).

    Methods inherited from class org.apache.camel.support.service.BaseService

    build, doFail, doLifecycleChange, doResume, doShutdown, doStart, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface org.apache.camel.Service

    build, close, init, start, stop

    Methods inherited from interface org.apache.camel.ShutdownableService

    shutdown

    Methods inherited from interface org.apache.camel.StatefulService

    getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspending

    Methods inherited from interface org.apache.camel.SuspendableService

    isSuspended, resume, suspend
  • Field Details

  • Constructor Details

    • MavenDownloaderImpl

      public MavenDownloaderImpl()
  • Method Details

    • doBuild

      protected void doBuild()
      Overrides:
      doBuild in class org.apache.camel.support.service.BaseService
    • doInit

      protected void doInit()
      Overrides:
      doInit in class org.apache.camel.support.service.BaseService
    • doStop

      protected void doStop() throws Exception
      Overrides:
      doStop in class org.apache.camel.support.service.BaseService
      Throws:
      Exception
    • setRemoteArtifactDownloadListener

      public void setRemoteArtifactDownloadListener(RemoteArtifactDownloadListener remoteArtifactDownloadListener)
      Description copied from interface: MavenDownloader
      To use a listener when downloading from remote repositories.
      Specified by:
      setRemoteArtifactDownloadListener in interface MavenDownloader
    • resolveArtifacts

      public List<MavenArtifact> resolveArtifacts(List<String> dependencyGAVs, Set<String> extraRepositories, boolean transitively, boolean useApacheSnapshots) throws MavenResolutionException
      Description copied from interface: MavenDownloader
      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.
      Specified by:
      resolveArtifacts in interface MavenDownloader
      Parameters:
      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
    • resolveAvailableVersions

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

      public MavenDownloader customize(String localRepository, int connectTimeout, int requestTimeout)
      Description copied from interface: MavenDownloader
      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.
      Specified by:
      customize in interface MavenDownloader
    • setMavenSettingsLocation

      public 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".
      Parameters:
      mavenSettings -
    • setMavenSettingsSecurityLocation

      public 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".
      Parameters:
      mavenSettingsSecurity -
    • setRepos

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

      public 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.
      Parameters:
      fresh -