Package org.eclipse.aether.internal.impl
Class EnhancedLocalRepositoryManagerFactory
java.lang.Object
org.eclipse.aether.internal.impl.EnhancedLocalRepositoryManagerFactory
- All Implemented Interfaces:
LocalRepositoryManagerFactory
@Singleton
@Named("enhanced")
public class EnhancedLocalRepositoryManagerFactory
extends Object
implements LocalRepositoryManagerFactory
Creates enhanced local repository managers for repository types
"default" or "" (automatic). Enhanced
local repository manager is built upon the classical Maven 2.0 local repository structure but additionally keeps
track of from what repositories a cached artifact was resolved. Resolution of locally cached artifacts will be
rejected in case the current resolution request does not match the known source repositories of an artifact, thereby
emulating physically separated artifact caches per remote repository.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringMarks whether the local repository is meant to be shared (or was shared) with legacy Maven 3.9 or older versions.static final StringFilename of the file in which to track the remote repositories.static final StringWhether to verify that the real (on-disk) path of a locally cached artifact matches the requested path spelling before the artifact is used.static final booleanstatic final Stringstatic final booleanstatic final String -
Constructor Summary
ConstructorsConstructorDescriptionEnhancedLocalRepositoryManagerFactory(LocalPathComposer localPathComposer, TrackingFileManager trackingFileManager, LocalPathPrefixComposerFactory localPathPrefixComposerFactory, RepositoryKeyFunctionFactory repositoryKeyFunctionFactory) -
Method Summary
Modifier and TypeMethodDescriptionfloatThe priority of this factory.newInstance(RepositorySystemSession session, LocalRepository repository) Tries to create a repository manager for the specified local repository.setPriority(float priority) Sets the priority of this component.
-
Field Details
-
NAME
- See Also:
-
CONFIG_PROP_TRACKING_FILENAME
Filename of the file in which to track the remote repositories.- See Also:
- Sourced from:
RepositorySystemSession.getConfigProperties()- Value type:
String- Default value:
DEFAULT_TRACKING_FILENAME
-
DEFAULT_TRACKING_FILENAME
- See Also:
-
CONFIG_PROP_VERIFY_REAL_PATH
Whether to verify that the real (on-disk) path of a locally cached artifact matches the requested path spelling before the artifact is used. On case-insensitive or case/normalization-preserving filesystems (the macOS and Windows defaults) a file cached for one set of coordinates also answers lookups for coordinates that differ only in case or Unicode normalization, while the repository tracking data is compared exactly: such an aliased file is treated as present-but-untracked and accepted with no download and no checksum verification, letting case-colliding coordinates poison distinct GAVs. When enabled (the default), an artifact whose on-disk path spelling differs from the requested one is treated as not present, forcing a proper download. Disable only if the local repository intentionally contains symbolic links below its base directory (a symlinked base directory itself is supported either way).- Since:
- 2.0.23
- See Also:
- Sourced from:
RepositorySystemSession.getConfigProperties()- Value type:
Boolean- Default value:
DEFAULT_VERIFY_REAL_PATH
-
DEFAULT_VERIFY_REAL_PATH
- See Also:
-
CONFIG_PROP_LEGACY_LOCAL_REPOSITORY
Marks whether the local repository is meant to be shared (or was shared) with legacy Maven 3.9 or older versions. Maven 3.9 and older versions suffer from "impostor" problem, where artifact and metadata origin was tracked only by the remote repository ID, where two remote repositories may share same ID but different URLs, in fact they may be completely unrelated to each other (ID clash by mistake), or, it may be due some sort of "impostor" attempt, where a malicious repository may pretend like some other repository. Right now, we intentionally default totrueto ease users transitioning, and Resolver 2 will retain this "old" behavior (will observe legacy tracking entries and will store remote metadata as before). But, at some point in the future, the default value will be changed tofalse(and same change is warmly recommended for modern Maven users, who do not intend to share local repository with older Maven versions). When this configuration set tofalse, the "repository key" is not ID only anymore, but is changed to$id-sha1($url)form, and this key is used in "origin tracking" entries and in caching remote Maven Repository Metadata XML files as well, guaranteeing they are not mixed in case of same IDs.- Since:
- 2.0.23
- See Also:
- Sourced from:
RepositorySystemSession.getConfigProperties()- Value type:
Boolean- Default value:
DEFAULT_LEGACY_LOCAL_REPOSITORY
-
DEFAULT_LEGACY_LOCAL_REPOSITORY
- See Also:
-
-
Constructor Details
-
EnhancedLocalRepositoryManagerFactory
@Inject public EnhancedLocalRepositoryManagerFactory(LocalPathComposer localPathComposer, TrackingFileManager trackingFileManager, LocalPathPrefixComposerFactory localPathPrefixComposerFactory, RepositoryKeyFunctionFactory repositoryKeyFunctionFactory)
-
-
Method Details
-
newInstance
public LocalRepositoryManager newInstance(RepositorySystemSession session, LocalRepository repository) throws NoLocalRepositoryManagerException Description copied from interface:LocalRepositoryManagerFactoryTries to create a repository manager for the specified local repository. The distinguishing property of a local repository is itstype, which may for example denote the used directory structure.- Specified by:
newInstancein interfaceLocalRepositoryManagerFactory- Parameters:
session- The repository system session from which to configure the manager, must not benull.repository- The local repository to create a manager for, must not benull.- Returns:
- The manager for the given repository, never
null. - Throws:
NoLocalRepositoryManagerException- If the factory cannot create a manager for the specified local repository.
-
getPriority
Description copied from interface:LocalRepositoryManagerFactoryThe priority of this factory. Factories with higher priority are preferred over those with lower priority.- Specified by:
getPriorityin interfaceLocalRepositoryManagerFactory- Returns:
- The priority of this factory.
-
setPriority
Sets the priority of this component.- Parameters:
priority- The priority.- Returns:
- This component for chaining, never
null.
-