Class MavenDependencyDownloader

java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.support.service.ServiceSupport
org.apache.camel.main.download.MavenDependencyDownloader
All Implemented Interfaces:
AutoCloseable, org.apache.camel.CamelContextAware, DependencyDownloader, org.apache.camel.Service, org.apache.camel.ShutdownableService, org.apache.camel.spi.HasCamelContext, org.apache.camel.StatefulService, org.apache.camel.StaticService, org.apache.camel.SuspendableService

public class MavenDependencyDownloader extends org.apache.camel.support.service.ServiceSupport implements DependencyDownloader
  • Constructor Details

    • MavenDependencyDownloader

      public MavenDependencyDownloader()
  • Method Details

    • getCamelContext

      public org.apache.camel.CamelContext getCamelContext()
      Specified by:
      getCamelContext in interface org.apache.camel.spi.HasCamelContext
    • setCamelContext

      public void setCamelContext(org.apache.camel.CamelContext camelContext)
      Specified by:
      setCamelContext in interface org.apache.camel.CamelContextAware
    • getClassLoader

      public ClassLoader getClassLoader()
      Description copied from interface: DependencyDownloader
      Classloader able to load from downloaded dependencies.
      Specified by:
      getClassLoader in interface DependencyDownloader
    • setClassLoader

      public void setClassLoader(ClassLoader classLoader)
      Description copied from interface: DependencyDownloader
      Sets the classloader to use that will be able to load from downloaded dependencies
      Specified by:
      setClassLoader in interface DependencyDownloader
    • isVerbose

      public boolean isVerbose()
    • setVerbose

      public void setVerbose(boolean verbose)
    • getKnownReposResolver

      public KnownReposResolver getKnownReposResolver()
    • setKnownReposResolver

      public void setKnownReposResolver(KnownReposResolver knownReposResolver)
    • getRepositoryResolver

      public org.apache.camel.tooling.maven.RepositoryResolver getRepositoryResolver()
      Description copied from interface: DependencyDownloader
      Gets the RepositoryResolver
      Specified by:
      getRepositoryResolver in interface DependencyDownloader
    • addDownloadListener

      public void addDownloadListener(DownloadListener downloadListener)
      Description copied from interface: DependencyDownloader
      Adds a listener to capture download activity
      Specified by:
      addDownloadListener in interface DependencyDownloader
    • addArtifactDownloadListener

      public void addArtifactDownloadListener(ArtifactDownloadListener downloadListener)
      Description copied from interface: DependencyDownloader
      Adds a listener to capture download activity
      Specified by:
      addArtifactDownloadListener in interface DependencyDownloader
    • getRepos

      public String getRepos()
      Specified by:
      getRepos in interface DependencyDownloader
    • setRepos

      public void setRepos(String repos)
      Description copied from interface: DependencyDownloader
      Additional maven repositories for download on-demand (Use commas to separate multiple repositories).
      Specified by:
      setRepos in interface DependencyDownloader
    • isFresh

      public boolean isFresh()
      Specified by:
      isFresh in interface DependencyDownloader
    • setFresh

      public void setFresh(boolean fresh)
      Description copied from interface: DependencyDownloader
      Make sure we use fresh (i.e. non-cached) resources.
      Specified by:
      setFresh in interface DependencyDownloader
    • isDownload

      public boolean isDownload()
      Description copied from interface: DependencyDownloader
      Whether downloading from remote Maven repositories is enabled
      Specified by:
      isDownload in interface DependencyDownloader
    • setDownload

      public void setDownload(boolean download)
      Description copied from interface: DependencyDownloader
      Whether downloading from remote Maven repositories is enabled
      Specified by:
      setDownload in interface DependencyDownloader
    • getMavenSettings

      public String getMavenSettings()
      Specified by:
      getMavenSettings in interface DependencyDownloader
    • setMavenSettings

      public void setMavenSettings(String mavenSettings)
      Description copied from interface: DependencyDownloader
      Configure location of Maven settings.xml file
      Specified by:
      setMavenSettings in interface DependencyDownloader
    • getMavenSettingsSecurity

      public String getMavenSettingsSecurity()
      Specified by:
      getMavenSettingsSecurity in interface DependencyDownloader
    • setMavenSettingsSecurity

      public void setMavenSettingsSecurity(String mavenSettingsSecurity)
      Description copied from interface: DependencyDownloader
      Configure location of Maven settings-security.xml file
      Specified by:
      setMavenSettingsSecurity in interface DependencyDownloader
    • downloadDependency

      public void downloadDependency(String groupId, String artifactId, String version)
      Description copied from interface: DependencyDownloader
      Downloads the dependency incl transitive dependencies
      Specified by:
      downloadDependency in interface DependencyDownloader
      Parameters:
      groupId - maven group id
      artifactId - maven artifact id
      version - maven version
    • downloadDependency

      public void downloadDependency(String groupId, String artifactId, String version, String extraRepos)
      Description copied from interface: DependencyDownloader
      Downloads the dependency incl transitive dependencies
      Specified by:
      downloadDependency in interface DependencyDownloader
      Parameters:
      groupId - maven group id
      artifactId - maven artifact id
      version - maven version
      extraRepos - additional remote maven repositories to use when downloading
    • downloadHiddenDependency

      public void downloadHiddenDependency(String groupId, String artifactId, String version)
      Description copied from interface: DependencyDownloader
      Downloads as hidden dependency that are not captured as a requirement
      Specified by:
      downloadHiddenDependency in interface DependencyDownloader
      Parameters:
      groupId - maven group id
      artifactId - maven artifact id
      version - maven version
    • downloadDependency

      public void downloadDependency(String groupId, String artifactId, String version, boolean transitively)
      Description copied from interface: DependencyDownloader
      Downloads the dependency
      Specified by:
      downloadDependency in interface DependencyDownloader
      Parameters:
      groupId - maven group id
      artifactId - maven artifact id
      version - maven version
      transitively - whether to include transitive dependencies
    • doDownloadDependency

      protected void doDownloadDependency(String groupId, String artifactId, String version, boolean transitively, boolean hidden, String extraRepos)
    • downloadArtifact

      public org.apache.camel.tooling.maven.MavenArtifact downloadArtifact(String groupId, String artifactId, String version)
      Description copied from interface: DependencyDownloader
      Downloads a single maven artifact (no transitive dependencies)
      Specified by:
      downloadArtifact in interface DependencyDownloader
      Parameters:
      groupId - maven group id
      artifactId - maven artifact id
      version - maven version
      Returns:
      the artifact, or null if none found
    • resolveAvailableVersions

      public List<String[]> resolveAvailableVersions(String groupId, String artifactId, String minimumVersion, String repo)
      Description copied from interface: DependencyDownloader
      Resolves the available versions for the given maven artifact
      Specified by:
      resolveAvailableVersions in interface DependencyDownloader
      Parameters:
      groupId - maven group id
      artifactId - maven artifact id
      minimumVersion - optional minimum version to avoid resolving too old releases
      repo - to use specific maven repository instead of maven central (used if repo is null)
      Returns:
      list of versions of the given artifact (0=camel-core version, 1=runtime version, such as spring-boot or quarkus)
    • alreadyOnClasspath

      public boolean alreadyOnClasspath(String groupId, String artifactId, String version)
      Description copied from interface: DependencyDownloader
      Checks whether the dependency is already on the classpath
      Specified by:
      alreadyOnClasspath in interface DependencyDownloader
      Parameters:
      groupId - maven group id
      artifactId - maven artifact id
      version - maven version
      Returns:
      true if already on classpath, false if not.
    • onLoadingKamelet

      public void onLoadingKamelet(String name)
      Description copied from interface: DependencyDownloader
      When a kamelet is being loaded
      Specified by:
      onLoadingKamelet in interface DependencyDownloader
      Parameters:
      name - the kamelet name
    • onLoadingModeline

      public void onLoadingModeline(String key, String value)
      Description copied from interface: DependencyDownloader
      When a modeline is being loaded
      Specified by:
      onLoadingModeline in interface DependencyDownloader
      Parameters:
      key - modeline key
      value - modeline value
    • getDownloadState

      public DownloadRecord getDownloadState(String groupId, String artifactId, String version)
      Description copied from interface: DependencyDownloader
      Gets download record for a given artifact
      Specified by:
      getDownloadState in interface DependencyDownloader
      Returns:
      download record (if any) or null if artifact was not downloaded, but could have been resolved from local disk
    • downloadRecords

      public Collection<DownloadRecord> downloadRecords()
      Description copied from interface: DependencyDownloader
      Gets the records for the downloaded artifacts
      Specified by:
      downloadRecords in interface DependencyDownloader
    • 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()
      Overrides:
      doStop in class org.apache.camel.support.service.BaseService
    • resolveDependenciesViaAether

      public List<org.apache.camel.tooling.maven.MavenArtifact> resolveDependenciesViaAether(List<String> depIds, Set<String> extraRepositories, boolean transitively, boolean useApacheSnapshots)