Package org.apache.camel.tooling.maven
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
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final org.slf4j.Loggerstatic final StringFields 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 TypeMethodDescriptionExisting, configuredMavenDownloadercan be used as a template to create customized version which shares most of the configuration except underlyingorg.eclipse.aether.RepositorySystemSession, which can't be shared.protected voiddoBuild()protected voiddoInit()protected voiddoStop()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.voidsetFresh(boolean fresh) Set a flag determining Maven update behavior.voidsetMavenSettingsLocation(String mavenSettings) Configure a location ofsettings.xml(when not set, defaults to~/.m2/settings.xmlunless it's explicitly set to"false".voidsetMavenSettingsSecurityLocation(String mavenSettingsSecurity) Configure a location ofsettings-security.xml(when not set, defaults to~/.m2/settings-security.xmlunlesssetMavenSettingsLocation(String)is set explicitly set to"false".voidsetRemoteArtifactDownloadListener(RemoteArtifactDownloadListener remoteArtifactDownloadListener) To use a listener when downloading from remote repositories.voidConfigure 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, 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
-
Field Details
-
LOG
public static final org.slf4j.Logger LOG -
MAVEN_CENTRAL_REPO
- See Also:
-
APACHE_SNAPSHOT_REPO
- See Also:
-
-
Constructor Details
-
MavenDownloaderImpl
public MavenDownloaderImpl()
-
-
Method Details
-
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
- Overrides:
doStopin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
setRemoteArtifactDownloadListener
public void setRemoteArtifactDownloadListener(RemoteArtifactDownloadListener remoteArtifactDownloadListener) Description copied from interface:MavenDownloaderTo use a listener when downloading from remote repositories.- Specified by:
setRemoteArtifactDownloadListenerin interfaceMavenDownloader
-
resolveArtifacts
public List<MavenArtifact> resolveArtifacts(List<String> dependencyGAVs, Set<String> extraRepositories, boolean transitively, boolean useApacheSnapshots) throws MavenResolutionException Description copied from interface:MavenDownloaderMain resolution method. Using Maven Resolver, a list of maven coordinates (in the form ofgroupId:artifactId[:packaging[:classifier]]:version) is used to download artifacts from configured Maven repositories.- Specified by:
resolveArtifactsin interfaceMavenDownloader- Parameters:
dependencyGAVs- a list of Maven coordinatesextraRepositories- nullable list of additional repositories to use (except the discovered ones)transitively- whether to download/resolve dependencies transitivelyuseApacheSnapshots- 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:MavenDownloaderResolves available versions for groupId + artifactId from single remote repository.- Specified by:
resolveAvailableVersionsin interfaceMavenDownloader- Parameters:
groupId- groupIdartifactId- artifactIdrepository- external repository to use (defaults to Maven Central ifnull)- Throws:
MavenResolutionException
-
customize
Description copied from interface:MavenDownloaderExisting, configuredMavenDownloadercan be used as a template to create customized version which shares most of the configuration except underlyingorg.eclipse.aether.RepositorySystemSession, which can't be shared.- Specified by:
customizein interfaceMavenDownloader
-
setMavenSettingsLocation
Configure a location ofsettings.xml(when not set, defaults to~/.m2/settings.xmlunless it's explicitly set to"false".- Parameters:
mavenSettings-
-
setMavenSettingsSecurityLocation
Configure a location ofsettings-security.xml(when not set, defaults to~/.m2/settings-security.xmlunlesssetMavenSettingsLocation(String)is set explicitly set to"false".- Parameters:
mavenSettingsSecurity-
-
setRepos
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-snapshotsMaven option. When set totrue, Maven metadata (to determine newest SNAPSHOT or RELEASE or LATEST version) is always fetched.- Parameters:
fresh-
-