Class RepositoryIdHelper
java.lang.Object
org.eclipse.aether.util.repository.RepositoryIdHelper
Helper class for
ArtifactRepository.getId()
handling. This class provides helper function (cached or uncached)
to get id of repository as it was originally envisioned: as path safe. While POMs are validated by Maven, there are
POMs out there that somehow define repositories with unsafe characters in their id. The problem affects mostly
RemoteRepository
instances, as all other implementations have fixed ids that are path safe.- Since:
- 2.0.11
-
Method Summary
Modifier and TypeMethodDescriptionstatic Function
<ArtifactRepository, String> Returns same instance of (session cached) function for session.static String
remoteRepositoryUniqueId
(RemoteRepository repository) Creates unique repository id for givenRemoteRepository
.
-
Method Details
-
remoteRepositoryUniqueId
Creates unique repository id for givenRemoteRepository
. For Maven Central this method will return string "central", while for any other remote repository it will return string created as$(repository.id)-sha1(repository-aspects)
. The key material contains all relevant aspects of remote repository, so repository with same ID even if just policy changes (enabled/disabled), will map to different string id. The checksum and update policies are not participating in key creation.This method is costly, so should be invoked sparingly, or cache results if needed.
-
cachedIdToPathSegment
public static Function<ArtifactRepository,String> cachedIdToPathSegment(RepositorySystemSession session) Returns same instance of (session cached) function for session.
-