Class PrefixesRemoteRepositoryFilterSource
java.lang.Object
org.eclipse.aether.internal.impl.filter.RemoteRepositoryFilterSourceSupport
org.eclipse.aether.internal.impl.filter.PrefixesRemoteRepositoryFilterSource
- All Implemented Interfaces:
RemoteRepositoryFilterSource
@Singleton
@Named("prefixes")
public final class PrefixesRemoteRepositoryFilterSource
extends RemoteRepositoryFilterSourceSupport
Remote repository filter source filtering on path prefixes. It is backed by a file that lists all allowed path
prefixes from remote repository. Artifact that layout converted path (using remote repository layout) results in
path with no corresponding prefix present in this file is filtered out.
The file can be authored manually: format is one prefix per line, comments starting with "#" (hash) and empty lines for structuring are supported, The "/" (slash) character is used as file separator. Some remote repositories and MRMs publish these kind of files, they can be downloaded from corresponding URLs.
The prefix file is expected on path "${basedir}/prefixes-${repository.id}.txt".
The prefixes file is once loaded and cached, so in-flight prefixes file change during component existence are not noticed.
Examples of published prefix files:
- Central: prefixes.txt
- Apache Releases: prefixes.txt
- Since:
- 1.9.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe basedir where to store filter files.static final StringConfiguration to enable the Prefixes filter (enabled by default).static final StringDetermines what happens when the filter is enabled, but has no prefixes available for given remote repository to work with.static final StringConfiguration to allow Prefixes file resolution attempt from remote repository as "auto discovery".static final StringConfiguration to skip the Prefixes filter for given request.static final StringConfiguration to allow Prefixes filter to auto-discover prefixes from mirrored repositories as well.static final StringConfiguration to allow Prefixes filter to auto-discover prefixes from repository managers as well.static final booleanstatic final booleanstatic final booleanstatic final booleanstatic final booleanstatic final booleanstatic final Stringstatic final StringFields inherited from class org.eclipse.aether.internal.impl.filter.RemoteRepositoryFilterSourceSupport
CONFIG_PROP_REPOSITORY_KEY_FUNCTION, CONFIG_PROPS_PREFIX, DEFAULT_REPOSITORY_KEY_FUNCTION -
Constructor Summary
ConstructorsConstructorDescriptionPrefixesRemoteRepositoryFilterSource(RepositoryKeyFunctionFactory repositoryKeyFunctionFactory, Supplier<MetadataResolver> metadataResolver, Supplier<RemoteRepositoryManager> remoteRepositoryManager, RepositoryLayoutProvider repositoryLayoutProvider) -
Method Summary
Modifier and TypeMethodDescriptionProvides the filter instance for given session, ornullif this instance wants to abstain from participating in filtering.protected booleanisEnabled(RepositorySystemSession session) Returnstrueif session configuration contains this name set totrue.Methods inherited from class org.eclipse.aether.internal.impl.filter.RemoteRepositoryFilterSourceSupport
getBasedir, normalizeRemoteRepository, repositoryKey
-
Field Details
-
NAME
- See Also:
-
CONFIG_PROP_ENABLED
Configuration to enable the Prefixes filter (enabled by default). Can be fine-tuned per repository using repository ID suffixes. Important: For this filter to take effect, configuration files must be available. Without configuration files, the enabled filter remains dormant and does not interfere with resolution. Configuration File Resolution:- User-provided files: Checked first from directory specified by
CONFIG_PROP_BASEDIR(defaults to$LOCAL_REPO/.remoteRepositoryFilters) - Auto-discovery: If not found, attempts to download from remote repository and cache locally
prefixes-$(repository.id).txtRecommended Setup (Auto-Discovery with Override Capability): Start with auto-discovery, but prepare for project-specific overrides. Add to.mvn/maven.config:-Daether.remoteRepositoryFilter.prefixes=true -Daether.remoteRepositoryFilter.prefixes.basedir=${session.rootDirectory}/.mvn/rrf/Initial setup: Don't provide any files - rely on auto-discovery as repositories are accessed. Override when needed: Createprefixes-myrepoId.txtfiles in.mvn/rrf/and commit to version control. Caching: Auto-discovered prefix files are cached in the local repository.- See Also:
- Sourced from:
RepositorySystemSession.getConfigProperties()- Value type:
Boolean- Default value:
DEFAULT_ENABLED- Supports Repo ID Suffix:
- Yes
- User-provided files: Checked first from directory specified by
-
DEFAULT_ENABLED
- See Also:
-
CONFIG_PROP_SKIPPED
Configuration to skip the Prefixes filter for given request. This configuration is evaluated and iftruethe prefixes remote filter will not kick in. Main use case is by filter itself, to prevent recursion during discovery of remote prefixes file, but this also allows other components to control prefix filter discovery, while leaving configuration likeCONFIG_PROP_ENABLEDstill show the "real state".- Since:
- 2.0.14
- See Also:
- Sourced from:
RepositorySystemSession.getConfigProperties()- Value type:
Boolean- Default value:
DEFAULT_SKIPPED- Supports Repo ID Suffix:
- Yes
-
DEFAULT_SKIPPED
- See Also:
-
CONFIG_PROP_NO_INPUT_OUTCOME
Determines what happens when the filter is enabled, but has no prefixes available for given remote repository to work with. When set totrue(default), the filter allows all requests to proceed for given remote repository when no prefixes are available. When set tofalse, the filter blocks all requests toward given remote repository when no prefixes are available. This setting allows repoId suffix, hence, can determine "global" or "repository targeted" behaviors.- Since:
- 2.0.14
- See Also:
- Sourced from:
RepositorySystemSession.getConfigProperties()- Value type:
Boolean- Default value:
DEFAULT_NO_INPUT_OUTCOME- Supports Repo ID Suffix:
- Yes
-
DEFAULT_NO_INPUT_OUTCOME
- See Also:
-
CONFIG_PROP_RESOLVE_PREFIX_FILES
Configuration to allow Prefixes file resolution attempt from remote repository as "auto discovery". If this configuration set tofalseonly user-provided prefixes will be used.- Since:
- 2.0.14
- See Also:
- Sourced from:
RepositorySystemSession.getConfigProperties()- Value type:
Boolean- Default value:
DEFAULT_RESOLVE_PREFIX_FILES- Supports Repo ID Suffix:
- Yes
-
DEFAULT_RESOLVE_PREFIX_FILES
- See Also:
-
CONFIG_PROP_USE_MIRRORED_REPOSITORIES
Configuration to allow Prefixes filter to auto-discover prefixes from mirrored repositories as well. For this to work Maven should be aware that given remote repository is mirror and is usually backed by MRM. Given multiple MRM implementations messes up prefixes file, is better to just skip these. In other case, one may useCONFIG_PROP_ENABLEDwith repository ID suffix.- Since:
- 2.0.14
- See Also:
- Sourced from:
RepositorySystemSession.getConfigProperties()- Value type:
Boolean- Default value:
DEFAULT_USE_MIRRORED_REPOSITORIES- Supports Repo ID Suffix:
- Yes
-
DEFAULT_USE_MIRRORED_REPOSITORIES
- See Also:
-
CONFIG_PROP_USE_REPOSITORY_MANAGERS
Configuration to allow Prefixes filter to auto-discover prefixes from repository managers as well. For this to work Maven should be aware that given remote repository is backed by repository manager. Given multiple MRM implementations messes up prefixes file, is better to just skip these. In other case, one may useCONFIG_PROP_ENABLEDwith repository ID suffix. Note: as of today, nothing sets this on remote repositories, but is added for future.- Since:
- 2.0.14
- See Also:
- Sourced from:
RepositorySystemSession.getConfigProperties()- Value type:
Boolean- Default value:
DEFAULT_USE_REPOSITORY_MANAGERS- Supports Repo ID Suffix:
- Yes
-
DEFAULT_USE_REPOSITORY_MANAGERS
- See Also:
-
CONFIG_PROP_BASEDIR
The basedir where to store filter files. If path is relative, it is resolved from local repository root.- See Also:
- Sourced from:
RepositorySystemSession.getConfigProperties()- Value type:
String- Default value:
LOCAL_REPO_PREFIX_DIR
-
LOCAL_REPO_PREFIX_DIR
- See Also:
-
-
Constructor Details
-
PrefixesRemoteRepositoryFilterSource
@Inject public PrefixesRemoteRepositoryFilterSource(RepositoryKeyFunctionFactory repositoryKeyFunctionFactory, Supplier<MetadataResolver> metadataResolver, Supplier<RemoteRepositoryManager> remoteRepositoryManager, RepositoryLayoutProvider repositoryLayoutProvider)
-
-
Method Details
-
isEnabled
Description copied from class:RemoteRepositoryFilterSourceSupportReturnstrueif session configuration contains this name set totrue.Default is
true.- Specified by:
isEnabledin classRemoteRepositoryFilterSourceSupport
-
getRemoteRepositoryFilter
Description copied from interface:RemoteRepositoryFilterSourceProvides the filter instance for given session, ornullif this instance wants to abstain from participating in filtering.- Returns:
- The filter for given session or
null.
-