Package org.apache.camel.main.download
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
-
Field Summary
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 -
Method Summary
Modifier and TypeMethodDescriptionvoidaddArtifactDownloadListener(ArtifactDownloadListener downloadListener) Adds a listener to capture download activityvoidaddDownloadListener(DownloadListener downloadListener) Adds a listener to capture download activitybooleanalreadyOnClasspath(String groupId, String artifactId, String version) Checks whether the dependency is already on the classpathprotected voiddoBuild()protected voiddoDownloadDependency(String groupId, String artifactId, String version, boolean transitively, boolean hidden, String extraRepos) protected voiddoInit()protected voiddoStop()org.apache.camel.tooling.maven.MavenArtifactdownloadArtifact(String groupId, String artifactId, String version) Downloads a single maven artifact (no transitive dependencies)voiddownloadDependency(String groupId, String artifactId, String version) Downloads the dependency incl transitive dependenciesvoiddownloadDependency(String groupId, String artifactId, String version, boolean transitively) Downloads the dependencyvoiddownloadDependency(String groupId, String artifactId, String version, String extraRepos) Downloads the dependency incl transitive dependenciesvoiddownloadHiddenDependency(String groupId, String artifactId, String version) Downloads as hidden dependency that are not captured as a requirementGets the records for the downloaded artifactsorg.apache.camel.CamelContextClassloader able to load from downloaded dependencies.getDownloadState(String groupId, String artifactId, String version) Gets download record for a given artifactgetRepos()org.apache.camel.tooling.maven.RepositoryResolverGets theRepositoryResolverbooleanWhether downloading from remote Maven repositories is enabledbooleanisFresh()booleanvoidonLoadingKamelet(String name) When a kamelet is being loadedvoidonLoadingModeline(String key, String value) When a modeline is being loadedresolveAvailableVersions(String groupId, String artifactId, String minimumVersion, String repo) Resolves the available versions for the given maven artifactList<org.apache.camel.tooling.maven.MavenArtifact> resolveDependenciesViaAether(List<String> depIds, Set<String> extraRepositories, boolean transitively, boolean useApacheSnapshots) voidsetCamelContext(org.apache.camel.CamelContext camelContext) voidsetClassLoader(ClassLoader classLoader) Sets the classloader to use that will be able to load from downloaded dependenciesvoidsetDownload(boolean download) Whether downloading from remote Maven repositories is enabledvoidsetFresh(boolean fresh) Make sure we use fresh (i.e.voidsetKnownReposResolver(KnownReposResolver knownReposResolver) voidsetMavenSettings(String mavenSettings) Configure location of Maven settings.xml filevoidsetMavenSettingsSecurity(String mavenSettingsSecurity) Configure location of Maven settings-security.xml filevoidAdditional maven repositories for download on-demand (Use commas to separate multiple repositories).voidsetVerbose(boolean verbose) 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, suspendMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.camel.Service
build, close, init, start, stopMethods inherited from interface org.apache.camel.ShutdownableService
shutdownMethods inherited from interface org.apache.camel.StatefulService
getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspendingMethods inherited from interface org.apache.camel.SuspendableService
isSuspended, resume, suspend
-
Constructor Details
-
MavenDependencyDownloader
public MavenDependencyDownloader()
-
-
Method Details
-
getCamelContext
public org.apache.camel.CamelContext getCamelContext()- Specified by:
getCamelContextin interfaceorg.apache.camel.spi.HasCamelContext
-
setCamelContext
public void setCamelContext(org.apache.camel.CamelContext camelContext) - Specified by:
setCamelContextin interfaceorg.apache.camel.CamelContextAware
-
getClassLoader
Description copied from interface:DependencyDownloaderClassloader able to load from downloaded dependencies.- Specified by:
getClassLoaderin interfaceDependencyDownloader
-
setClassLoader
Description copied from interface:DependencyDownloaderSets the classloader to use that will be able to load from downloaded dependencies- Specified by:
setClassLoaderin interfaceDependencyDownloader
-
isVerbose
public boolean isVerbose() -
setVerbose
public void setVerbose(boolean verbose) -
getKnownReposResolver
-
setKnownReposResolver
-
getRepositoryResolver
public org.apache.camel.tooling.maven.RepositoryResolver getRepositoryResolver()Description copied from interface:DependencyDownloaderGets theRepositoryResolver- Specified by:
getRepositoryResolverin interfaceDependencyDownloader
-
addDownloadListener
Description copied from interface:DependencyDownloaderAdds a listener to capture download activity- Specified by:
addDownloadListenerin interfaceDependencyDownloader
-
addArtifactDownloadListener
Description copied from interface:DependencyDownloaderAdds a listener to capture download activity- Specified by:
addArtifactDownloadListenerin interfaceDependencyDownloader
-
getRepos
- Specified by:
getReposin interfaceDependencyDownloader
-
setRepos
Description copied from interface:DependencyDownloaderAdditional maven repositories for download on-demand (Use commas to separate multiple repositories).- Specified by:
setReposin interfaceDependencyDownloader
-
isFresh
public boolean isFresh()- Specified by:
isFreshin interfaceDependencyDownloader
-
setFresh
public void setFresh(boolean fresh) Description copied from interface:DependencyDownloaderMake sure we use fresh (i.e. non-cached) resources.- Specified by:
setFreshin interfaceDependencyDownloader
-
isDownload
public boolean isDownload()Description copied from interface:DependencyDownloaderWhether downloading from remote Maven repositories is enabled- Specified by:
isDownloadin interfaceDependencyDownloader
-
setDownload
public void setDownload(boolean download) Description copied from interface:DependencyDownloaderWhether downloading from remote Maven repositories is enabled- Specified by:
setDownloadin interfaceDependencyDownloader
-
getMavenSettings
- Specified by:
getMavenSettingsin interfaceDependencyDownloader
-
setMavenSettings
Description copied from interface:DependencyDownloaderConfigure location of Maven settings.xml file- Specified by:
setMavenSettingsin interfaceDependencyDownloader
-
getMavenSettingsSecurity
- Specified by:
getMavenSettingsSecurityin interfaceDependencyDownloader
-
setMavenSettingsSecurity
Description copied from interface:DependencyDownloaderConfigure location of Maven settings-security.xml file- Specified by:
setMavenSettingsSecurityin interfaceDependencyDownloader
-
downloadDependency
Description copied from interface:DependencyDownloaderDownloads the dependency incl transitive dependencies- Specified by:
downloadDependencyin interfaceDependencyDownloader- Parameters:
groupId- maven group idartifactId- maven artifact idversion- maven version
-
downloadDependency
public void downloadDependency(String groupId, String artifactId, String version, String extraRepos) Description copied from interface:DependencyDownloaderDownloads the dependency incl transitive dependencies- Specified by:
downloadDependencyin interfaceDependencyDownloader- Parameters:
groupId- maven group idartifactId- maven artifact idversion- maven versionextraRepos- additional remote maven repositories to use when downloading
-
downloadHiddenDependency
Description copied from interface:DependencyDownloaderDownloads as hidden dependency that are not captured as a requirement- Specified by:
downloadHiddenDependencyin interfaceDependencyDownloader- Parameters:
groupId- maven group idartifactId- maven artifact idversion- maven version
-
downloadDependency
public void downloadDependency(String groupId, String artifactId, String version, boolean transitively) Description copied from interface:DependencyDownloaderDownloads the dependency- Specified by:
downloadDependencyin interfaceDependencyDownloader- Parameters:
groupId- maven group idartifactId- maven artifact idversion- maven versiontransitively- whether to include transitive dependencies
-
doDownloadDependency
-
downloadArtifact
public org.apache.camel.tooling.maven.MavenArtifact downloadArtifact(String groupId, String artifactId, String version) Description copied from interface:DependencyDownloaderDownloads a single maven artifact (no transitive dependencies)- Specified by:
downloadArtifactin interfaceDependencyDownloader- Parameters:
groupId- maven group idartifactId- maven artifact idversion- 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:DependencyDownloaderResolves the available versions for the given maven artifact- Specified by:
resolveAvailableVersionsin interfaceDependencyDownloader- Parameters:
groupId- maven group idartifactId- maven artifact idminimumVersion- optional minimum version to avoid resolving too old releasesrepo- to use specific maven repository instead of maven central (used if repo isnull)- Returns:
- list of versions of the given artifact (0=camel-core version, 1=runtime version, such as spring-boot or quarkus)
-
alreadyOnClasspath
Description copied from interface:DependencyDownloaderChecks whether the dependency is already on the classpath- Specified by:
alreadyOnClasspathin interfaceDependencyDownloader- Parameters:
groupId- maven group idartifactId- maven artifact idversion- maven version- Returns:
- true if already on classpath, false if not.
-
onLoadingKamelet
Description copied from interface:DependencyDownloaderWhen a kamelet is being loaded- Specified by:
onLoadingKameletin interfaceDependencyDownloader- Parameters:
name- the kamelet name
-
onLoadingModeline
Description copied from interface:DependencyDownloaderWhen a modeline is being loaded- Specified by:
onLoadingModelinein interfaceDependencyDownloader- Parameters:
key- modeline keyvalue- modeline value
-
getDownloadState
Description copied from interface:DependencyDownloaderGets download record for a given artifact- Specified by:
getDownloadStatein interfaceDependencyDownloader- Returns:
- download record (if any) or null if artifact was not downloaded, but could have been resolved from local disk
-
downloadRecords
Description copied from interface:DependencyDownloaderGets the records for the downloaded artifacts- Specified by:
downloadRecordsin interfaceDependencyDownloader
-
doBuild
protected void doBuild()- Overrides:
doBuildin classorg.apache.camel.support.service.BaseService
-
doInit
protected void doInit()- Overrides:
doInitin classorg.apache.camel.support.service.BaseService
-
doStop
protected void doStop()- Overrides:
doStopin classorg.apache.camel.support.service.BaseService
-
resolveDependenciesViaAether
-