Package org.apache.ivy.plugins.resolver
Class DualResolver
java.lang.Object
org.apache.ivy.plugins.resolver.AbstractResolver
org.apache.ivy.plugins.resolver.DualResolver
- All Implemented Interfaces:
Validatable
,DependencyResolver
,HasLatestStrategy
DualResolver is used to resolve dependencies with one dependency revolver, called ivy resolver,
and then download artifacts found in the resolved dependencies from a second dependency resolver,
called artifact resolver. It is especially useful with resolvers using repository where there is
a lot of artifact, but no ivy file, like the maven ibiblio repository. If no ivy file is found by
the ivy resolver, the artifact resolver is used to check if there is artifact corresponding to
the request (with default ivy file). For artifact download, however, only the artifact resolver
is used. Exactly two resolvers should be added to this resolver for it to work properly. The
first resolver added if the ivy resolver, the second is the artifact one.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
add
(DependencyResolver resolver) void
beginPublishTransaction
(ModuleRevisionId module, boolean overwrite) void
download
(ArtifactOrigin artifact, DownloadOptions options) Default implementation downloads the artifact without taking advantage of its locationdownload
(Artifact[] artifacts, DownloadOptions options) Download artifacts with specified DownloadOptions.void
boolean
Returnstrue
if the given artifact can be located by this resolver and actually exist.findIvyFileRef
(DependencyDescriptor dd, ResolveData data) Finds the module descriptor for the specified DependencyDescriptor.getDependency
(DependencyDescriptor dd, ResolveData data) Resolve a module by id, getting its module descriptor and resolving the revision if it's a latest one (i.e.boolean
Default implementation actually download the artifact Subclasses should overwrite this to avoid the downloadvoid
void
Reports last resolve failure as Messagesvoid
reportFailure
(Artifact art) Reports last artifact download failure as Messagesvoid
setAllownomd
(boolean allownomd) void
setArtifactResolver
(DependencyResolver artifactResolver) void
setDescriptor
(String descriptorRule) Sets the module descriptor presence rule.void
setIvyResolver
(DependencyResolver ivyResolver) Methods inherited from class org.apache.ivy.plugins.resolver.AbstractResolver
checkInterrupted, checkLatest, doValidate, findModuleInCache, findModuleInCache, fromSystem, fromSystem, getCacheDownloadOptions, getCacheOptions, getChangingMatcherName, getChangingPattern, getDownloadOptions, getEventManager, getLatest, getLatestStrategy, getName, getNamespace, getParserSettings, getRepositoryCacheManager, getSettings, getSystemNode, getTimeoutConstraint, getTypeName, hidePassword, isAfter, isValidate, listModules, listOrganisations, listRevisions, listTokenValues, listTokenValues, saveModuleRevisionIfNeeded, setCache, setChangingMatcher, setChangingPattern, setCheckmodified, setEventManager, setLatest, setLatestStrategy, setName, setNamespace, setRepositoryCacheManager, setSettings, setTimeoutConstraint, setValidate, toString, toSystem, toSystem, toSystem, toSystem, toSystem, toSystem, validate
-
Field Details
-
DESCRIPTOR_OPTIONAL
- See Also:
-
DESCRIPTOR_REQUIRED
- See Also:
-
-
Constructor Details
-
DualResolver
public DualResolver()
-
-
Method Details
-
add
-
getDependency
public ResolvedModuleRevision getDependency(DependencyDescriptor dd, ResolveData data) throws ParseException Description copied from interface:DependencyResolver
Resolve a module by id, getting its module descriptor and resolving the revision if it's a latest one (i.e. a revision uniquely identifying the revision of a module in the current environment - If this revision is not able to identify uniquely the revision of the module outside of the current environment, then the resolved revision must begin by ##)- Parameters:
dd
- DependencyDescriptordata
- ResolveData- Returns:
- ResolvedModuleRevision
- Throws:
ParseException
- if something goes wrong
-
findIvyFileRef
Description copied from interface:DependencyResolver
Finds the module descriptor for the specified DependencyDescriptor. If this resolver can't find the module descriptor, null is returned.- Parameters:
dd
- the dependency descriptordata
- the resolve data- Returns:
- the module descriptor, or null
-
reportFailure
public void reportFailure()Description copied from interface:DependencyResolver
Reports last resolve failure as Messages- Specified by:
reportFailure
in interfaceDependencyResolver
- Overrides:
reportFailure
in classAbstractResolver
-
reportFailure
Description copied from interface:DependencyResolver
Reports last artifact download failure as Messages- Specified by:
reportFailure
in interfaceDependencyResolver
- Overrides:
reportFailure
in classAbstractResolver
- Parameters:
art
- Artifact
-
download
Description copied from interface:DependencyResolver
Download artifacts with specified DownloadOptions.The resolver will always make a best effort, and do not stop when an artifact is not available. It rather continue to attempt to download other requested artifacts, and report what has been done in the returned DownloadReport.
The returned DownloadReport is never
null
, and always contain anArtifactDownloadReport
for each requested Artifact.- Parameters:
artifacts
- an array of artifacts to download. Must not benull
.options
- options to apply for this download. Must not benull
.- Returns:
- a DownloadReport with details about each Artifact download.
-
getArtifactResolver
-
setArtifactResolver
-
getIvyResolver
-
setIvyResolver
-
publish
- Throws:
IOException
-
abortPublishTransaction
- Specified by:
abortPublishTransaction
in interfaceDependencyResolver
- Overrides:
abortPublishTransaction
in classAbstractResolver
- Throws:
IOException
-
beginPublishTransaction
- Specified by:
beginPublishTransaction
in interfaceDependencyResolver
- Overrides:
beginPublishTransaction
in classAbstractResolver
- Throws:
IOException
-
commitPublishTransaction
- Specified by:
commitPublishTransaction
in interfaceDependencyResolver
- Overrides:
commitPublishTransaction
in classAbstractResolver
- Throws:
IOException
-
dumpSettings
public void dumpSettings()- Specified by:
dumpSettings
in interfaceDependencyResolver
- Overrides:
dumpSettings
in classAbstractResolver
-
exists
Description copied from interface:DependencyResolver
Returnstrue
if the given artifact can be located by this resolver and actually exist.- Specified by:
exists
in interfaceDependencyResolver
- Overrides:
exists
in classAbstractResolver
- Parameters:
artifact
- the artifact which should be tested.- Returns:
true
if the given artifact can be located by this resolver and actually exist.
-
locate
Description copied from class:AbstractResolver
Default implementation actually download the artifact Subclasses should overwrite this to avoid the download- Specified by:
locate
in interfaceDependencyResolver
- Overrides:
locate
in classAbstractResolver
- Parameters:
artifact
- ArtifactOrigin- Returns:
- ArtifactOrigin
-
download
Description copied from class:AbstractResolver
Default implementation downloads the artifact without taking advantage of its location- Specified by:
download
in interfaceDependencyResolver
- Overrides:
download
in classAbstractResolver
- Parameters:
artifact
- ArtifactOriginoptions
- DownloadOptions- Returns:
- ArtifactDownloadReport
-
isAllownomd
public boolean isAllownomd() -
setAllownomd
public void setAllownomd(boolean allownomd) -
setDescriptor
Sets the module descriptor presence rule. Should be one ofDESCRIPTOR_REQUIRED
orDESCRIPTOR_OPTIONAL
.- Parameters:
descriptorRule
- the descriptor rule to use with this resolver.
-