Class PrefixesRemoteRepositoryFilterSource

java.lang.Object
org.eclipse.aether.internal.impl.filter.RemoteRepositoryFilterSourceSupport
org.eclipse.aether.internal.impl.filter.PrefixesRemoteRepositoryFilterSource
All Implemented Interfaces:
org.eclipse.aether.spi.connector.filter.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:

Since:
1.9.0
  • Field Details

    • NAME

      public static final String NAME
      See Also:
    • CONFIG_PROP_ENABLED

      public static final String 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:
      1. User-provided files: Checked first from directory specified by CONFIG_PROP_BASEDIR (defaults to $LOCAL_REPO/.remoteRepositoryFilters)
      2. Auto-discovery: If not found, attempts to download from remote repository and cache locally
      File Naming: prefixes-$(repository.id).txt Recommended 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: Create prefixes-myrepoId.txt files 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
    • DEFAULT_ENABLED

      public static final boolean DEFAULT_ENABLED
      See Also:
    • CONFIG_PROP_SKIPPED

      public static final String CONFIG_PROP_SKIPPED
      Configuration to skip the Prefixes filter for given request. This configuration is evaluated and if true the 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 like CONFIG_PROP_ENABLED still 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

      public static final boolean DEFAULT_SKIPPED
      See Also:
    • CONFIG_PROP_NO_INPUT_OUTCOME

      public static final String 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 to true (default), the filter allows all requests to proceed for given remote repository when no prefixes are available. When set to false, 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

      public static final boolean 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 to false only 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

      public static final boolean 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 use CONFIG_PROP_ENABLED with 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

      public static final boolean 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 use CONFIG_PROP_ENABLED with 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

      public static final boolean DEFAULT_USE_REPOSITORY_MANAGERS
      See Also:
    • CONFIG_PROP_BASEDIR

      public static final String 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

      public static final String LOCAL_REPO_PREFIX_DIR
      See Also:
  • Constructor Details

  • Method Details